Class FunctionQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.queries.function.FunctionQuery
-
public class FunctionQuery extends Query
Returns a score for each document based on a ValueSource, often some function of the value of a field.- See Also:
ValueSourceScorer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FunctionQuery.AllScorer
Scores all documents, applying the function to each documentprotected class
FunctionQuery.FunctionWeight
Creates FunctionQuery scorer instances
-
Field Summary
Fields Modifier and Type Field Description (package private) ValueSource
func
-
Constructor Summary
Constructors Constructor Description FunctionQuery(ValueSource func)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Weight
createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
Expert: Constructs an appropriate Weight implementation for this query.boolean
equals(java.lang.Object other)
Returns true ifo
is equal to this.ValueSource
getValueSource()
int
hashCode()
Override and implement query hash code properly in a subclass.java.lang.String
toString(java.lang.String field)
Prints a user-readable version of this query.void
visit(QueryVisitor visitor)
Recurse through the query tree, visiting any child queries-
Methods inherited from class org.apache.lucene.search.Query
classHash, rewrite, sameClassAs, toString
-
-
-
-
Field Detail
-
func
final ValueSource func
-
-
Constructor Detail
-
FunctionQuery
public FunctionQuery(ValueSource func)
- Parameters:
func
- defines the function to be used for scoring
-
-
Method Detail
-
getValueSource
public ValueSource getValueSource()
- Returns:
- The associated ValueSource
-
visit
public void visit(QueryVisitor visitor)
Description copied from class:Query
Recurse through the query tree, visiting any child queries
-
createWeight
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws java.io.IOException
Description copied from class:Query
Expert: Constructs an appropriate Weight implementation for this query.Only implemented by primitive queries, which re-write to themselves.
- Overrides:
createWeight
in classQuery
scoreMode
- How the produced scorers will be consumed.boost
- The boost that is propagated by the parent queries.- Throws:
java.io.IOException
-
toString
public java.lang.String toString(java.lang.String field)
Prints a user-readable version of this query.
-
equals
public boolean equals(java.lang.Object other)
Returns true ifo
is equal to this.- Specified by:
equals
in classQuery
- See Also:
Query.sameClassAs(Object)
,Query.classHash()
-
hashCode
public int hashCode()
Description copied from class:Query
Override and implement query hash code properly in a subclass. This is required so thatQueryCache
works properly.- Specified by:
hashCode
in classQuery
- See Also:
Query.equals(Object)
-
-