Class ContextQueriesWrapper
java.lang.Object
org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper
A wrapper of
Use
queries
about a search context.
Use
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>>)
by Returnable
s in order to choose
the part for each Context the Returnable
cares about (by passing an empty optional
or a joiner
/producer
)
and transform it to a Query
.-
Constructor Summary
ConstructorDescriptionContextQueriesWrapper
(Query siteQuery, Query sitemapQuery, SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang, Query tagQuery) Creates a wrapper of Context Queries (site, sitemap, lang, tag). -
Method Summary
Modifier and TypeMethodDescriptionGet the context lang and current langstatic Query
getQuery
(Collection<ContextQueriesWrapper> contextQueriesWrappers, Optional<Function<Query, Query>> siteQueryJoiner, Optional<Function<Query, Query>> sitemapQueryJoiner, Optional<SearchContext.LangQueryProducer> langQueryProducer, Optional<Function<Query, Query>> tagQueryJoiner) Gets the query corresponding to the given contexts (as a collection ofContextQueriesWrapper
)
By passing anempty optional
or ajoiner
/producer
, you are able to choose the part of the contexts you want to ignore/take account in the generated query.Get the sitemap queryGet the site queryGet the tag query
-
Constructor Details
-
ContextQueriesWrapper
public ContextQueriesWrapper(Query siteQuery, Query sitemapQuery, SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang, Query tagQuery) Creates a wrapper of Context Queries (site, sitemap, lang, tag).- Parameters:
siteQuery
- The site querysitemapQuery
- The sitemap querycontextLangAndCurrentLang
- The wrapper ofContextLang
and the current langtagQuery
- The tag query
-
-
Method Details
-
getSiteQuery
Get the site query- Returns:
- the site query
-
getSitemapQuery
Get the sitemap query- Returns:
- the sitemap query
-
getContextLangAndCurrentLang
Get the context lang and current lang- Returns:
- the context lang and current lang
-
getTagQuery
Get the tag query- Returns:
- the tag query
-
getQuery
public static Query getQuery(Collection<ContextQueriesWrapper> contextQueriesWrappers, Optional<Function<Query, Query>> siteQueryJoiner, Optional<Function<Query, Query>> sitemapQueryJoiner, Optional<SearchContext.LangQueryProducer> langQueryProducer, Optional<Function<Query, Query>> tagQueryJoiner) Gets the query corresponding to the given contexts (as a collection ofContextQueriesWrapper
)
By passing anempty optional
or ajoiner
/producer
, you are able to choose the part of the contexts you want to ignore/take account in the generated query.- Parameters:
contextQueriesWrappers
- The wrappers ofcontext queries
siteQueryJoiner
- The joiner for the site querysitemapQueryJoiner
- The joiner for the sitemap querylangQueryProducer
- The producer of the lang querytagQueryJoiner
- The joiner for the tag query- Returns:
- the query corresponding to the given contexts
-