Class QueryElevationComponent.DefaultElevationProvider
- java.lang.Object
-
- org.apache.solr.handler.component.QueryElevationComponent.DefaultElevationProvider
-
- All Implemented Interfaces:
QueryElevationComponent.ElevationProvider
- Enclosing class:
- QueryElevationComponent
protected class QueryElevationComponent.DefaultElevationProvider extends Object implements QueryElevationComponent.ElevationProvider
Provides elevations with either:- subset match - all the elevating terms are matched in the search query, in any order.
- exact match - the elevating query matches fully (all terms in same order) the search query.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultElevationProvider(QueryElevationComponent.TrieSubsetMatcher.Builder<String,QueryElevationComponent.Elevation> subsetMatcherBuilder, Map<QueryElevationComponent.ElevatingQuery,QueryElevationComponent.ElevationBuilder> elevationBuilderMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryElevationComponent.Elevation
getElevationForQuery(String queryString)
Gets the elevation associated to the provided query.int
size()
Gets the number of query elevations in thisQueryElevationComponent.ElevationProvider
.
-
-
-
Constructor Detail
-
DefaultElevationProvider
protected DefaultElevationProvider(QueryElevationComponent.TrieSubsetMatcher.Builder<String,QueryElevationComponent.Elevation> subsetMatcherBuilder, Map<QueryElevationComponent.ElevatingQuery,QueryElevationComponent.ElevationBuilder> elevationBuilderMap)
- Parameters:
subsetMatcherBuilder
- TheQueryElevationComponent.TrieSubsetMatcher.Builder
to build theQueryElevationComponent.TrieSubsetMatcher
.elevationBuilderMap
- The map of elevation rules.
-
-
Method Detail
-
getElevationForQuery
public QueryElevationComponent.Elevation getElevationForQuery(String queryString)
Description copied from interface:QueryElevationComponent.ElevationProvider
Gets the elevation associated to the provided query.By contract and by design, only one elevation may be associated to a given query (this can be safely verified by an assertion).
- Specified by:
getElevationForQuery
in interfaceQueryElevationComponent.ElevationProvider
- Parameters:
queryString
- The query string (notanalyzed
yet, thisQueryElevationComponent.ElevationProvider
is in charge of analyzing it).- Returns:
- The elevation associated with the query; or
null
if none.
-
size
public int size()
Description copied from interface:QueryElevationComponent.ElevationProvider
Gets the number of query elevations in thisQueryElevationComponent.ElevationProvider
.- Specified by:
size
in interfaceQueryElevationComponent.ElevationProvider
-
-