Class SearchContext.LangQueryProducer
java.lang.Object
org.ametys.web.frontoffice.search.instance.model.SearchContext.LangQueryProducer
- Enclosing class:
- SearchContext
Class wrapping an implementation of
Instances of this class should be created only in
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
.
Instances of this class should be created only in
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>>)
- See Also:
-
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>>)
-
Constructor Summary
ConstructorDescriptionLangQueryProducer
(Class<? extends Query> languageQueryClass, boolean acceptDocWithNolang) Constructs aSearchContext.LangQueryProducer
The given class must have at least two constructors: one with no arguments in order to testexistence
; one with anQuery.Operator
and an array ofString
values in order to testequality
of the current language. -
Method Summary
Modifier and TypeMethodDescriptionfinal Query
produce
(SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang) Produces the Query for testing the context language
-
Constructor Details
-
LangQueryProducer
Constructs aSearchContext.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 ofString
values in order to testequality
of the current language.
- Parameters:
languageQueryClass
- The implementation ofQuery
for testing the langacceptDocWithNolang
-true
to accept documents with no lang
- one with no arguments in order to test
-
-
Method Details
-
produce
public final Query produce(SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang) throws Exception Produces the Query for testing the context language- Parameters:
contextLangAndCurrentLang
- The wrapper of theContextLang
and the real current language- Returns:
- a
Query
- Throws:
Exception
- if an error occurs
-