: > >      public interface DocIterator {
: > >          public int doc();
: > >          public boolean next();
: > >          public boolean skipTo(int target);
: > >      }

: Btw. the DocNrSkipper referred to earlier has this DocIterator functionality
: in one method:
:
: int nextDocNr(int)
:
: returning -1 when there is no next document number.
: Yonik mentioned that it would be good for performance to add this:
:
: int nextDocNr()
:
: implicitly using the last document number without the need to pass it.
:
: The advantage of using -1 instead of boolean is that only one
: return value needs to be used, saving a method call in many cases
: during query search, but at the expensive of an extra test for the
: return value being positive.

I've never fully been able to wrap my head arround that patch, but i'm
starting to get the idea.  I really like the idea of a common super
interface shared by Scorers, TermDocs, and Filters ... but that's just my
sense of aesthetic talking, your point about saving method calls makes
sense (especially since a Filter has no other information to share for
each doc).

So perhaps the steps I outlined before would make sense as a way to roll
out "DocNrSkipper" as the the "new Filter" interface, with
BitSetSortedIntList serving as the wrapper for filters that can best be
implimented using the current BitSet approach (and as a way to migrate the
existing filters in a backwards compatible way).

I have to say though, i'm not wild about the name "DocNrSkipper" (that
whole aesthetic thing again)...

  1) commit DocNrSkipper interface to the core code base
  2) add the following method declaration to the Filter class...
        public DocNrSkipper getSkipper(IndexReader) throws IOException
     ...impliment this method by calling bits, and returning an instance
     of BitSetSortedIntList
  3) indicate that Filter.bits() is deprecated.
  4) change all existing calls to Filter.bits() in the core lucene code
     base to call Filter.getSkipper and do whatever iterating is
     neccessary.
  5) gradually reimpliment all of the concrete instances of Filter in
     the core lucene code base so they override the getSkipper method
     with something that returns a more "iterator" style DocNrSkipper,
     and impliment their bits() method to use the DocNrSkipper from the
     new getSkipper() method to build up the bit set if clients call it
     directly.
  6) wait a suitable amount of time.
  7) remove Filter.bits() and all of the concrete implimentations from the
     lucene core.




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to