Home » lucene-3.0.1-src » org.apache » lucene » search » function » [javadoc | source]
org.apache.lucene.search.function
public class: CustomScoreQuery [javadoc | source]
java.lang.Object
   org.apache.lucene.search.Query
      org.apache.lucene.search.function.CustomScoreQuery

All Implemented Interfaces:
    Cloneable, Serializable

Query that sets document score as a programmatic function of several (sub) scores:
  1. the score of its subQuery (any query)
  2. (optional) the score of its ValueSourceQuery (or queries). For most simple/convenient use cases this query is likely to be a FieldScoreQuery
Subclasses can modify the computation by overriding #getCustomScoreProvider .

WARNING: The status of the search.function package is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.
Constructor:
 public CustomScoreQuery(Query subQuery) 
    Create a CustomScoreQuery over input subQuery.
    Parameters:
    subQuery - the sub query whose scored is being customed. Must not be null.
 public CustomScoreQuery(Query subQuery,
    ValueSourceQuery valSrcQuery) 
    Parameters:
    subQuery - the sub query whose score is being customized. Must not be null.
    valSrcQuery - a value source query whose scores are used in the custom score computation. For most simple/convenient use case this would be a FieldScoreQuery . This parameter is optional - it can be null.
 public CustomScoreQuery(Query subQuery,
    ValueSourceQuery valSrcQueries) 
    Parameters:
    subQuery - the sub query whose score is being customized. Must not be null.
    valSrcQueries - value source queries whose scores are used in the custom score computation. For most simple/convenient use case these would be FieldScoreQueries . This parameter is optional - it can be null or even an empty array.
Method from org.apache.lucene.search.function.CustomScoreQuery Summary:
clone,   createWeight,   customExplain,   customExplain,   customScore,   customScore,   equals,   extractTerms,   getCustomScoreProvider,   hashCode,   isStrict,   name,   rewrite,   setStrict,   toString
Methods from org.apache.lucene.search.Query:
clone,   combine,   createWeight,   equals,   extractTerms,   getBoost,   getSimilarity,   hashCode,   mergeBooleanQueries,   rewrite,   setBoost,   toString,   toString,   weight
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.function.CustomScoreQuery Detail:
 public Object clone() 
 public Weight createWeight(Searcher searcher) throws IOException 
 public Explanation customExplain(int doc,
    Explanation subQueryExpl,
    Explanation[] valSrcExpls) 
Deprecated! Will - be removed in Lucene 3.1. The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override #getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader .

    Explain the custom score.
 public Explanation customExplain(int doc,
    Explanation subQueryExpl,
    Explanation valSrcExpl) 
Deprecated! Will - be removed in Lucene 3.1. The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override #getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader .

    Explain the custom score.
 public float customScore(int doc,
    float subQueryScore,
    float[] valSrcScores) 
Deprecated! Will - be removed in Lucene 3.1. The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override #getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader .

    Compute a custom score by the subQuery score and a number of ValueSourceQuery scores.
 public float customScore(int doc,
    float subQueryScore,
    float valSrcScore) 
Deprecated! Will - be removed in Lucene 3.1. The doc is relative to the current reader, which is unknown to CustomScoreQuery when using per-segment search (since Lucene 2.9). Please override #getCustomScoreProvider and return a subclass of CustomScoreProvider for the given IndexReader .

    Compute a custom score by the subQuery score and the ValueSourceQuery score.
 public boolean equals(Object o) 
    Returns true if o is equal to this.
 public  void extractTerms(Set<Term> terms) 
 protected CustomScoreProvider getCustomScoreProvider(IndexReader reader) throws IOException 
 public int hashCode() 
    Returns a hash code value for this object.
 public boolean isStrict() 
    Checks if this is strict custom scoring. In strict custom scoring, the ValueSource part does not participate in weight normalization. This may be useful when one wants full control over how scores are modified, and does not care about normalizing by the ValueSource part. One particular case where this is useful if for testing this query.

    Note: only has effect when the ValueSource part is not null.

 public String name() 
 public Query rewrite(IndexReader reader) throws IOException 
 public  void setStrict(boolean strict) 
    Set the strict mode of this query.
 public String toString(String field)