You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Gregory Tarr <Gr...@detica.com> on 2010/05/12 11:38:37 UTC

Unsupported operation in DocIdSetIterator using lucene 2.9

I am using lucene 2.9 and I can't understand why a succession of
un-deprecated methods calls a deprecated method in this class.
The series of calls is as follows:

Searcher.search(Query, Collector)
IndexSearcher.search(Weight, Filter, Collector)
Scorer.score(Collector)
DocIdSetIterator.nextDoc()
DocIdSetIterator.next()

The javadocs for next() say that you should call nextDoc() but yet the
nextDoc() method calls next()!

I understand it is changing in 3.0, but can this be made to work in 2.9
without editing the code?

Many thanks,

Greg Tarr


This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory.  The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


RE: Unsupported operation in DocIdSetIterator using lucene 2.9

Posted by Uwe Schindler <uw...@thetaphi.de>.
> I am using lucene 2.9 and I can't understand why a succession of
> un-deprecated methods calls a deprecated method in this class.
> The series of calls is as follows:
> 
> Searcher.search(Query, Collector)
> IndexSearcher.search(Weight, Filter, Collector)
> Scorer.score(Collector)
> DocIdSetIterator.nextDoc()
> DocIdSetIterator.next()
> 
> The javadocs for next() say that you should call nextDoc() but yet the
> nextDoc() method calls next()!

This is he correct behavior for deprecating methods that are intended to be overridden by users (in this case abstract ones - abstract in 2.4). The reason behind is:

If you have legacy 2.4 code that is not yet updated to use nextDoc(), but only overrided the previously abstract next(), the backwards layer in the default implementation of DocIdSetIterator calls next() for you, so the old code still works. If you have code that is already on 3.0 or 2.9 stage, you will override nextDoc() and next() is never used.

The nextDoc() -> next() is therefore only called, when you have an 2.4 legacy class.

Uwe


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org