lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: SortField questions
Date Tue, 04 Aug 2009 09:46:56 GMT
On Mon, Aug 3, 2009 at 10:29 PM, Yonik Seeley<yonik@lucidimagination.com> wrote:
> Why is "reversed" passed into SortField.getComparator(), and what does it mean?
> Should it always be passed as sortField.getReversed() (and if so, why
> does the param exist at all)?

reversed may be passed on to some comparators (currently only
StringOrdVal and CUSTOM) so that they can possibly optimize when that
field is the primary sort.  EG StringOrdVal uses this to bound the
binary search when remapping the ord (looking up the ord by String
value) in its convert method.

> Also, FieldComparator has no javadoc for most of it's methods.  For example:
>    public void setNextReader(IndexReader reader, int docBase,  int
> numSlotsFull) throws IOException;

I'll spruce up these javadocs.  I think after 2.9 feature freeze we
should do lots of javadoc'ing... eg I want to add javadoc to the
CharStream/Reader/Filter classes too.

> I can figure out the other params, but how does one set numSlotsFull
> and what does it mean?

numSlotsFull tells you how full the pqueue is; ie, you use it to
figure out if you're still in the "startup transient" (you haven't
seen enough hits to fill the pqueue yet), by checking if it's <
numHits, and eg iterate only over that number of slots.

Actually I think we should simply remove the param... it's a leftover
from some optimizations we had tried but apparently now removed from
what finally was committed.  It's confusing and unused!

I'll open an issue.

Mike

---------------------------------------------------------------------
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