lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: CompareBottom and setBottom in TopFieldCollector and FieldComparator
Date Fri, 10 Jul 2009 11:35:04 GMT
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 <raimon.bosch@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
>
>


--

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message