Class ContextQueriesWrapper
- java.lang.Object
-
- org.ametys.web.frontoffice.search.metamodel.context.ContextQueriesWrapper
-
public class ContextQueriesWrapper extends Object
A wrapper ofqueries
about a search context.
UsegetQuery(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>>)
byReturnable
s in order to choose the part for each Context theReturnable
cares about (by passing anempty optional
or ajoiner
/producer
) and transform it to aQuery
.
-
-
Constructor Summary
Constructors Constructor Description ContextQueriesWrapper(Query siteQuery, Query sitemapQuery, SearchContext.ContextLangAndCurrentLang contextLangAndCurrentLang, Query tagQuery)
Creates a wrapper of Context Queries (site, sitemap, lang, tag).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<SearchContext.ContextLangAndCurrentLang>
getContextLangAndCurrentLang()
Get 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.Optional<Query>
getSitemapQuery()
Get the sitemap queryOptional<Query>
getSiteQuery()
Get the site queryOptional<Query>
getTagQuery()
Get the tag query
-
-
-
Constructor Detail
-
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 Detail
-
getSiteQuery
public Optional<Query> getSiteQuery()
Get the site query- Returns:
- the site query
-
getSitemapQuery
public Optional<Query> getSitemapQuery()
Get the sitemap query- Returns:
- the sitemap query
-
getContextLangAndCurrentLang
public Optional<SearchContext.ContextLangAndCurrentLang> getContextLangAndCurrentLang()
Get the context lang and current lang- Returns:
- the context lang and current lang
-
getTagQuery
public Optional<Query> 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
-
-