public static final class SearchContext.LangQueryProducer extends Object
Query
in order to produce(org.ametys.web.frontoffice.search.instance.model.SearchContext.ContextLangAndCurrentLang)
the final query executed for limiting the context language for a given Returnable
.
Returnable.filterReturnedDocumentQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, org.ametys.web.frontoffice.search.metamodel.AdditionalParameterValueMap)
methods, and then passed to ContextQueriesWrapper.getQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<org.ametys.web.frontoffice.search.instance.model.SearchContext.LangQueryProducer>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>)
Returnable.filterReturnedDocumentQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, org.ametys.web.frontoffice.search.metamodel.AdditionalParameterValueMap)
,
ContextQueriesWrapper.getQuery(java.util.Collection<org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>, java.util.Optional<org.ametys.web.frontoffice.search.instance.model.SearchContext.LangQueryProducer>, java.util.Optional<java.util.function.Function<org.ametys.cms.search.query.Query, org.ametys.cms.search.query.Query>>)
Modifier and Type | Field and Description |
---|---|
private boolean |
_acceptDocWithNolang |
private Constructor<? extends Query> |
_noArgConstructor |
private Constructor<? extends Query> |
_opAndStrConstructor |
Constructor and Description |
---|
LangQueryProducer(Class<? extends Query> languageQueryClass,
boolean acceptDocWithNolang)
Constructs a
SearchContext.LangQueryProducer
The given class must have at least two constructors: one with no arguments in order to test existence ;
one with an Query.Operator and an array of String values in order to test equality of the current language.
|
Modifier and Type | Method and Description |
---|---|
Query |
produce(SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang)
Produces the Query for testing the context language
|
private Constructor<? extends Query> _noArgConstructor
private Constructor<? extends Query> _opAndStrConstructor
private boolean _acceptDocWithNolang
public LangQueryProducer(Class<? extends Query> languageQueryClass, boolean acceptDocWithNolang)
SearchContext.LangQueryProducer
existence
;Query.Operator
and an array of String
values in order to test equality
of the current language.languageQueryClass
- The implementation of Query
for testing the langacceptDocWithNolang
- true
to accept documents with no langpublic final Query produce(SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang) throws Exception
contextLangAndCurrentLang
- The wrapper of the ContextLang
and the real current languageQuery
Exception
- if an error occurs