lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-1614) Add next() and skipTo() variants to DocIdSetIterator that return the current doc, instead of boolean
Date Thu, 21 May 2009 10:22:45 GMT


Shai Erera commented on LUCENE-1614:

bq. SortedVIntList subclasses DocIdSet

Sorry, did not notice that. It's just that the test confused me, since I though it just stores
VInts with no direct relation to doc Ids.

bq. maybe we need to choose a different name than nextDoc()

Why? just because OBSI declared a method which we wanted anyway? You know .. it's something
we don't give much thought to when we add methods to abstract classes, but what if someone
extended DISI and added his own advance(int) or nextDoc() which don't behave like we expect
them to. When he'll pass his DISI to the search flow somehow, not knowing these have become
the primary methods, something will break.

I'm not saying we should protect these cases too, because otherwise we won't be able to make
any changes. But just because OBSI had nextDoc() declared doesn't mean we should go and find
a different name. That's slightly unrelated to this issue, but our back-compat policy forces
us to replace good names with moderate ones, just because we cannot change methods.

Can't we just document in CHANGES that nextDoc() now returns MAX_VAL when no more docs exist,
and we fix the test in tag? I mean, how many users do we think use OBSI directly?

bq. MAX_VAL is not a valid docID

I'll remove the test then (from trunk and tag) and document on DISI this assumption.

> Add next() and skipTo() variants to DocIdSetIterator that return the current doc, instead
of boolean
> ----------------------------------------------------------------------------------------------------
>                 Key: LUCENE-1614
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Shai Erera
>             Fix For: 2.9
>         Attachments: LUCENE-1614.patch
> See
for the full discussion. The basic idea is to add variants to those two methods that return
the current doc they are at, to save successive calls to doc(). If there are no more docs,
return -1. A summary of what was discussed so far:
> # Deprecate those two methods.
> # Add nextDoc() and skipToDoc(int) that return doc, with default impl in DISI (calls
next() and skipTo() respectively, and will be changed to abstract in 3.0).
> #* I actually would like to propose an alternative to the names: advance() and advance(int)
- the first advances by one, the second advances to target.
> # Wherever these are used, do something like '(doc = advance()) >= 0' instead of comparing
to -1 for improved performance.
> I will post a patch shortly

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message