On Monday 02 May 2005 23:38, Wolfgang Hoschek wrote:
> > Yes, the svn trunk uses skipTo more often than 1.4.3.
> >
> > However, your implementation of skipTo() needs some improvement.
> > See the javadoc of skipTo of class Scorer:
> >
> > http://lucene.apache.org/java/docs/api/org/apache/lucene/search/
> > Scorer.html#skipTo(int)
>
> What's wrong with the version I sent? Remeber that there can be at most
> one document in a MemoryIndex. So the "target" parameter can safely be
> ignored, as far as I can see.
Correct, I did not realize that there is only a single doc in the index.
>
> >
> > In case the underlying scorers provide skipTo() it's even better to
> > use that.
> >
>
> The version I sent returns in O(1), if performance was your concern. Or
> did you mean something else?
Since 0 is the only document number in the index, a
return target == 0;
might be nice for skipTo(). It doesn't really help performance, though,
and the next() works just as well.
Regards,
Paul Elschot.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
|