lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <yo...@apache.org>
Subject Re: Boost One Term Query
Date Thu, 06 Dec 2007 20:00:17 GMT
On Dec 6, 2007 2:31 PM, java_user_ <jkraemer@cs.tufts.edu> wrote:
> Thanks for the response Hoss.
>
> The score I receive is from the Explaination object.  The score stays the
> same regardless of how I boost the single term.
>
> The score of the query:
> apple
>
> Is the same as the score of the query:
> apple^3

This boosts apple 3 times in relation to the other query clauses.  If
there are no other query clauses, it's a bit meaningless.

> I am surprised by the result of the test.  Would you expect "apple" and
> "apple^3" to receive the same score?

Lucene does some "weighting" of the query that causes this to happen.

class Query { [...]
  /** Expert: Constructs and initializes a Weight for a top-level query. */
  public Weight weight(Searcher searcher)
    throws IOException {
    Query query = searcher.rewrite(this);
    Weight weight = query.createWeight(searcher);
    float sum = weight.sumOfSquaredWeights();
    float norm = getSimilarity(searcher).queryNorm(sum);
    weight.normalize(norm);
    return weight;
  }

Are you simply curious about this, or is it causing you a problem somehow?

-Yonik

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message