lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <yo...@apache.org>
Subject Re: Scoring in MatchAllDocsQuery & ConstantScoreQuery
Date Sat, 25 Nov 2006 16:04:34 GMT
On 11/25/06, Paul Elschot <paul.elschot@xs4all.nl> wrote:
> On Saturday 25 November 2006 07:59, Otis Gospodnetic wrote:
> > Hi,
> >
> > Poking around Query/Weight/Scorer classes I finally started understanding
> how some portions of the scoring works (imagine a lot of lightbulbs now).  In
> one of my Lucene use-cases I really just use it to pull N documents from an
> index, and don't care for score (I sort by time).  That lead me to look at
> MatchAllDocsQuery and ConstantScoreQuery.  I see they don't do anything with
> IDF nor anything fancy with Similarity, and instead both queries return a
> score equal to the query boost.  Still, why do they even bother with the
> multiplications in sumOfSquaredWeights() and normalize(float) methods?
> >
> >     public float sumOfSquaredWeights() {
> >       queryWeight = getBoost();
> >       return queryWeight * queryWeight;
> >     }
> >
> >     public void normalize(float queryNorm) {
> >       this.queryNorm = queryNorm;
> >       queryWeight *= this.queryNorm;
> >     }
> >
> > Shouldn't that queryWeight = getBoost() be enough to get the query boost and
> use it as a score?

No, that would break the relative weights of other clauses and you
would end up with the ConstantScoreQuery or MatchAllDocsQuery having a
much higher weight in the final score than it should.


-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

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


Mime
View raw message