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
.
-
-
Field Summary
Fields Modifier and Type Field Description private SearchContext.ContextLangAndCurrentLang
_contextLangAndCurrentLang
private Query
_sitemapQuery
private Query
_siteQuery
private Query
_tagQuery
-
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 private Query
_getQuery(Optional<Function<Query,Query>> siteQueryJoiner, Optional<Function<Query,Query>> sitemapQueryJoiner, Optional<SearchContext.LangQueryProducer> langQueryProducer, Optional<Function<Query,Query>> tagQueryJoiner)
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.
-
-
-
Field Detail
-
_siteQuery
private Query _siteQuery
-
_sitemapQuery
private Query _sitemapQuery
-
_contextLangAndCurrentLang
private SearchContext.ContextLangAndCurrentLang _contextLangAndCurrentLang
-
-
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
-
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
-
-