You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Mark Miller <ma...@gmail.com> on 2009/07/10 13:35:04 UTC
Re: CompareBottom and setBottom in TopFieldCollector and
FieldComparator
There are a lot of calls to compare that only compare to the bottom (think
of the common case when the queue fills quickly). Set and compare bottom
cache that value. So you can pre cache the bottom ord and save derefing into
the array. It could just as easily be a call to compare, but it would be
slower.
--
- Mark
http://www.lucidimagination.com
On Fri, Jul 10, 2009 at 10:55 AM, Raimon Bosch <ra...@gmail.com>wrote:
>
>
> Hi,
>
> I don't understand the uses of compareBottom and setBottom. I've seen that
> setBottom is setting always the minimal score during the comparisons but I
> don't see why we need this value.
>
> In the TopFieldCollector I saw this piece of code:
>
> ////////////
> final int cmp = reverseMul * comparator.compareBottom(doc);
> if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID)) {
> return;
> }
> if (cmp < 0 || (cmp == 0 && doc + docBase > bottom.docID)) {
> return;
> }
> //////////
>
> that I suppose that is the real use of the function but I don't understand
> it 100%. Any ideas?
>
> Regards,
> Raimon Bosch.
> --
> View this message in context:
> http://www.nabble.com/CompareBottom-and-setBottom-in-TopFieldCollector-and-FieldComparator-tp24425303p24425303.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
--