You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Otis Gospodnetic <ot...@yahoo.com> on 2006/05/09 03:34:40 UTC
Changing Lucene scoring?
Hi,
Not sure if people caught my question over on java-user@ about the possibility of eliminating floating point calculations from Lucene's scoring. Before I embark on this, I thought I'd ask:
- Am I crazy? Is this at all doable?
- Is this doable without forking and maintaining my own patches?
- Other than looking through the code, is there anything that would help me learn how various scoring pieces relate to one another?
One of the reasons I am looking at this is because I often need just yes/no (matches/doesn't match) answers, and don't care for the score.
The other reason is that I've been told Sun's Niagara machines have a weak FPU, so we are trying to squeeze more juice out of them by reducing the amount of floating point math in scoring.
If there are better approaches than trying to change how Lucene scoring works, please let me know.
Thanks,
Otis
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by Yonik Seeley <ys...@gmail.com>.
On 5/8/06, Otis Gospodnetic <ot...@yahoo.com> wrote:
> Not sure if people caught my question over on java-user@ about the possibility of eliminating floating point calculations from Lucene's scoring. Before I embark on this, I thought I'd ask:
>
> - Am I crazy? Is this at all doable?
Do you have an estimate on how much time you would save to get a
feeling if it would be worth it?
Some scorers don't calculate a score until you call score(), so you
could create your query, create a Weight, and ask the Weight for a
Scorer. Then just keep calling next() to get all the matches.
For example, TermScorer and ConjunctionScorer don't calculate scores
in next(), so a query like +field1:foo +field2:bar would work fine
with this method.
-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
Re: Changing Lucene scoring?
Posted by Chris Hostetter <ho...@fucit.org>.
: One of the reasons I am looking at this is because I often need just
: yes/no (matches/doesn't match) answers, and don't care for the score.
I didn't realize that was an option -- i thought you wanted integer
scoring, and the best advice i had for that was to search and replace.
But if you just care about match/no-match why not just use Filters? Most
of the basics already exist (except ironically a TermFilter) so all you
might need is a "FilterParser".
: The other reason is that I've been told Sun's Niagara machines have a
: weak FPU, so we are trying to squeeze more juice out of them by reducing
: the amount of floating point math in scoring.
As allways: run some simple benchmarks before you assume it won't be fast
enough.
-Hoss
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by Mu...@cis.strath.ac.uk.
Hi,
I'm not happy with the how scoring works either, it might be efficient
though. I have been investigating the code for a while. Everything gets
down to
-Query (TermQuery, BooleanQuery, PhraseQuery etc.),
-Inner class Weight in Query,
-Similarity,
-Scorer (TermScorer, BooleanScorer etc.)
and interaction between them. Highly wired, back and forth method calls,
query re-writings and so on.
I guess the main challenge is the Query and its derived classes. At the
moment there is not entry point to dive and add your independent scoring
models.
(I hope I understood u guys right.)
Murat,
> On Mon, 2006-05-08 at 18:34 -0700, Otis Gospodnetic wrote:
>> Hi,
>>
>> Not sure if people caught my question over on java-user@
>> about the possibility of eliminating floating point
>> calculations from Lucene's scoring. Before I embark on this,
>> I thought I'd ask:
>>
>> - Am I crazy?
>
> I'm all for a refactor of the scoring strategy. A single interface
> attached to the index that takes care of it all.
>
>> Is this at all doable?
>
> Of course it is.
>
>> - Is this doable without forking and maintaining my own
>> patches?
>
> That I doubt. I have no deep knowledge of the scoring mechanism, but the
> current classes are heavily couple by how the boosts work. It would
> require a huge amount of deprication.
>
> I would start with creating the new interface Index, inherited by
> Directory or any other top level index implementation.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by karl wettin <ka...@snigel.net>.
On Mon, 2006-05-08 at 18:34 -0700, Otis Gospodnetic wrote:
> Hi,
>
> Not sure if people caught my question over on java-user@
> about the possibility of eliminating floating point
> calculations from Lucene's scoring. Before I embark on this,
> I thought I'd ask:
>
> - Am I crazy?
I'm all for a refactor of the scoring strategy. A single interface
attached to the index that takes care of it all.
> Is this at all doable?
Of course it is.
> - Is this doable without forking and maintaining my own
> patches?
That I doubt. I have no deep knowledge of the scoring mechanism, but the
current classes are heavily couple by how the boosts work. It would
require a huge amount of deprication.
I would start with creating the new interface Index, inherited by
Directory or any other top level index implementation.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by Grant Ingersoll <gs...@syr.edu>.
Otis wrote:
> Short answer: no. Damn are those scoring classes hard to follow...
>
I have looked at these classes several times, including stepping through
them and I still find them confusing. Perhaps someone (Doug????? pretty
please?) could illuminate us?
I think the part I always found tricky was how it combines the
precomputed items (idf, norms, etc.) and what the relationship is
between the Scorers, Queries and the Weights and how they all work
together to come up with a single score. And, of course, there is the
relationship to the Similarity class too...
Perhaps we could flesh out a document that better describes scoring,
something on par with the File Formats document
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by karl wettin <ka...@snigel.net>.
On Fri, 2006-05-19 at 20:20 -0700, Otis Gospodnetic wrote:
> On Mon, 2006-05-08 at 18:34 -0700, Otis Gospodnetic wrote:
> > > about the possibility of eliminating floating point calculations from
> > > Lucene's scoring
>
> > Did you look in to this?
>
>
> No, not yet. I did start looking at how exactly scoring works
> (debugger, step through), but then had to switch to benchmarking
> Lucene on a set of different machines/OSs/JVMs. Short answer: no.
> Damn are those scoring classes hard to follow...
I gave it a glance.
The floats originate from Similarity and IndexReader.norms[].
Eliminating them leaves a term count score, or so.
Perhaps it is possible to run on int instead if there is a fast
sqrt(int) out there. I can think of multiple problems when implementing
an int norm value. An plenty of ugly solutions that might not be that
fast at all.
I also started looking from Hits.gatherMoreHits() -> TopDocs to find out
how to bypass the whole scoring mechanism, but it is all very coupled
and, as you say, hard to follow.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by Otis Gospodnetic <ot...@yahoo.com>.
On Mon, 2006-05-08 at 18:34 -0700, Otis Gospodnetic wrote:
> about the possibility of eliminating floating point calculations from
> Lucene's scoring
Did you look in to this?
No, not yet. I did start looking at how exactly scoring works (debugger, step through), but then had to switch to benchmarking Lucene on a set of different machines/OSs/JVMs.
Short answer: no. Damn are those scoring classes hard to follow...
Otis
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by karl wettin <ka...@snigel.net>.
On Mon, 2006-05-08 at 18:34 -0700, Otis Gospodnetic wrote:
> about the possibility of eliminating floating point calculations from
> Lucene's scoring
Did you look in to this?
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Changing Lucene scoring?
Posted by eks dev <ek...@yahoo.co.uk>.
Hi Otis,
"I often need just yes/no (matches/doesn't match) answers,... "
Not sure if you ment this: "how I could implement pure boolean model, completely avoiding scoring?".
If yes, what comes to my mind is Filtering, ChainedFilter, ConstantScore* and all these discussions about implementing non-scoring Query mechanics. If I remeber well, Doug had some, as usual, good proposals on this topic, Yonik and Hoss allready made some really good things.
----- Original Message ----
From: Otis Gospodnetic <ot...@yahoo.com>
To: java-dev@lucene.apache.org
Sent: Tuesday, 9 May, 2006 3:34:40 AM
Subject: Changing Lucene scoring?
Hi,
Not sure if people caught my question over on java-user@ about the possibility of eliminating floating point calculations from Lucene's scoring. Before I embark on this, I thought I'd ask:
- Am I crazy? Is this at all doable?
- Is this doable without forking and maintaining my own patches?
- Other than looking through the code, is there anything that would help me learn how various scoring pieces relate to one another?
One of the reasons I am looking at this is because I often need just yes/no (matches/doesn't match) answers, and don't care for the score.
The other reason is that I've been told Sun's Niagara machines have a weak FPU, so we are trying to squeeze more juice out of them by reducing the amount of floating point math in scoring.
If there are better approaches than trying to change how Lucene scoring works, please let me know.
Thanks,
Otis
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org