Package org.apache.solr.search
Class SolrConstantScoreQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.solr.search.SolrConstantScoreQuery
-
- All Implemented Interfaces:
ExtendedQuery
- Direct Known Subclasses:
FunctionRangeQuery
public class SolrConstantScoreQuery extends org.apache.lucene.search.Query implements ExtendedQuery
A query that wraps a filter and simply returns a constant score equal to the query boost for every document in the filter. This Solr extension also supports weighting of a SolrFilter. Experimental and subject to change.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSolrConstantScoreQuery.ConstantWeight
-
Constructor Summary
Constructors Constructor Description SolrConstantScoreQuery(Filter filter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.lucene.search.WeightcreateWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, float boost)booleanequals(Object other)Returns true ifois equal to this.booleangetCache()Should this query be cached in the query cache or filter cache.booleangetCacheSep()If true, the clauses of this boolean query should be cached separately.intgetCost()Returns the cost of this query, used to order checking of filters that are not cached.FiltergetFilter()Returns the encapsulated filterinthashCode()Returns a hash code value for this object.voidsetCache(boolean cache)voidsetCacheSep(boolean cacheSep)voidsetCost(int cost)StringtoString(String field)Prints a user-readable version of this query.
-
-
-
Constructor Detail
-
SolrConstantScoreQuery
public SolrConstantScoreQuery(Filter filter)
-
-
Method Detail
-
getFilter
public Filter getFilter()
Returns the encapsulated filter
-
setCache
public void setCache(boolean cache)
- Specified by:
setCachein interfaceExtendedQuery
-
getCache
public boolean getCache()
Description copied from interface:ExtendedQueryShould this query be cached in the query cache or filter cache.- Specified by:
getCachein interfaceExtendedQuery
-
setCacheSep
public void setCacheSep(boolean cacheSep)
- Specified by:
setCacheSepin interfaceExtendedQuery
-
getCacheSep
public boolean getCacheSep()
Description copied from interface:ExtendedQueryIf true, the clauses of this boolean query should be cached separately. This is not yet implemented.- Specified by:
getCacheSepin interfaceExtendedQuery
-
setCost
public void setCost(int cost)
- Specified by:
setCostin interfaceExtendedQuery
-
getCost
public int getCost()
Description copied from interface:ExtendedQueryReturns the cost of this query, used to order checking of filters that are not cached. If getCache()==false && getCost()>=100 && this instanceof PostFilter, then the PostFilter interface will be used for filtering.- Specified by:
getCostin interfaceExtendedQuery
-
createWeight
public org.apache.lucene.search.Weight createWeight(org.apache.lucene.search.IndexSearcher searcher, boolean needsScores, float boost) throws IOException- Overrides:
createWeightin classorg.apache.lucene.search.Query- Throws:
IOException
-
toString
public String toString(String field)
Prints a user-readable version of this query.- Specified by:
toStringin classorg.apache.lucene.search.Query
-
equals
public boolean equals(Object other)
Returns true ifois equal to this.- Specified by:
equalsin classorg.apache.lucene.search.Query
-
hashCode
public int hashCode()
Returns a hash code value for this object.- Specified by:
hashCodein classorg.apache.lucene.search.Query
-
-