Hi,
I'm porting a piece of code that uses TermPositions of Lucene 3.3 to 8.9.
https://lucene.apache.org/core/4_0_0/MIGRATE.html reads:

 *

   TermPositions is renamed to DocsAndPositionsEnum, and no longer extends the
   docs only enumerator (DocsEnum).

But DocsAndPositionsEnum doesn't exist in 8.9 either. There is no mention of removal of DocsAndPositionsEnum in any of MIGRATE.html files.

Is there a recommended way to replace TermPositions? Here is the code I am trying to port to give you a context:

private void calculateScores() throws IOException { // initialize buffers FixedBitSet docPointers = new FixedBitSet(reader.maxDoc()); List<Term> uniqueTerms = new LinkedList<>(new LinkedHashSet<>(terms)); uniqueTermSize = uniqueTerms.size(); this.roughThresholdFreq = (int) (uniqueTermSize * ROUGH_CUTOFF); for (Iterator<Term> iter = uniqueTerms.iterator(); iter.hasNext();) { try (TermPositions tp = reader.termPositions(iter.next())) { while (tp.next()) { int f = scoredDocs.adjustOrPutValue(tp.doc(), 1, 1); if (f > roughThresholdFreq) { docPointers.fastSet(tp.doc()); } } } } if (docPointers.cardinality() > 0) { docPointerIterator = (FixedBitSetIterator) docPointers.iterator(); } }


TK

Reply via email to