lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <>
Subject Re: search(Query query, HitCollector results)
Date Sun, 15 Feb 2009 18:48:36 GMT
Michael McCandless wrote:
> Mark Miller wrote:
>>> So HitCollector#collect(int doc, float score) is not called in a 
>>> special
>>> (default) order and must order the docs itself by score if one needs 
>>> the
>>> hits sorted by relevance?
>>> Presumably there is no score ordering to the hit id's lucene 
>>> delivers to
>>> a HitCollector? i.e. they are delivered in the order they are found and
>>> score is neither ascending or descending i.e. the next score could be
>>> higher or lower that the previous one?
>> They come in doc id order unless you change 
>> BooleanQuery#setAllowDocsOutOfOrder(boolean allow) (I'm pretty sure 
>> thats the only case, but not positive)
> In general, the docIDs are not guaranteed to arrive in order to the 
> HitCollector.  EG in 2.9, IndexSearcher can visit the segments in a 
> different order.
> Mike
Up to 2.4 (current release), they do come in order though, right?

We should update the javadocs in BooleanQuery before 2.9 goes out:

   * Specifics: By setting this option to true, calls to
   * {@link HitCollector#collect(int,float)} might be
   * invoked first for docid N and only later for docid N-1.
   * Being static, this setting is system wide.
   * </p>
  public static void setAllowDocsOutOfOrder(boolean allow) {

This implies they are normally in doc id order (which they were until 
2.9 right?)

- Mark

- Mark

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message