@Override public void reset() throws IOException { super.reset(); previous.clear(); } }
@Override protected void doSetNextReader(LeafReaderContext context) throws IOException { docBase = context.docBase; if (seenSurfaceForms != null) { seenSurfaceForms.clear(); // NOTE: this also clears the priorityQueue: for (TopSuggestDocs.SuggestScoreDoc hit : priorityQueue.getResults()) { pendingResults.add(hit); } } }
seenSurfaceForms.clear();
@Override public boolean incrementToken() throws IOException { while (input.incrementToken()) { final char term[] = termAttribute.buffer(); final int length = termAttribute.length(); final int posIncrement = posIncAttribute.getPositionIncrement(); if (posIncrement > 0) { previous.clear(); } boolean duplicate = (posIncrement == 0 && previous.contains(term, 0, length)); // clone the term, and add to the set of seen terms. char saved[] = new char[length]; System.arraycopy(term, 0, saved, 0, length); previous.add(saved); if (!duplicate) { return true; } } return false; }
@Override public final void reset() throws IOException { super.reset(); previous.clear(); } }
@Override public final void reset() throws IOException { super.reset(); previous.clear(); } }
@Override protected void doSetNextReader(LeafReaderContext context) throws IOException { docBase = context.docBase; if (seenSurfaceForms != null) { seenSurfaceForms.clear(); // NOTE: this also clears the priorityQueue: for (TopSuggestDocs.SuggestScoreDoc hit : priorityQueue.getResults()) { pendingResults.add(hit); } } }
@Override protected void doSetNextReader(LeafReaderContext context) throws IOException { docBase = context.docBase; if (seenSurfaceForms != null) { seenSurfaceForms.clear(); // NOTE: this also clears the priorityQueue: for (TopSuggestDocs.SuggestScoreDoc hit : priorityQueue.getResults()) { pendingResults.add(hit); } } }
seenSurfaceForms.clear();
seenSurfaceForms.clear();
@Override public final boolean incrementToken() throws IOException { while (input.incrementToken()) { final char term[] = termAttribute.buffer(); final int length = termAttribute.length(); boolean duplicate; if (onlyOnSamePosition) { final int posIncrement = posIncAttribute.getPositionIncrement(); if (posIncrement > 0) { previous.clear(); } duplicate = (posIncrement == 0 && previous.contains(term, 0, length)); } else { duplicate = previous.contains(term, 0, length); } // clone the term, and add to the set of seen terms. char saved[] = new char[length]; System.arraycopy(term, 0, saved, 0, length); previous.add(saved); if (!duplicate) { return true; } } return false; }
@Override public final boolean incrementToken() throws IOException { while (input.incrementToken()) { final char term[] = termAttribute.buffer(); final int length = termAttribute.length(); boolean duplicate; if (onlyOnSamePosition) { final int posIncrement = posIncAttribute.getPositionIncrement(); if (posIncrement > 0) { previous.clear(); } duplicate = (posIncrement == 0 && previous.contains(term, 0, length)); } else { duplicate = previous.contains(term, 0, length); } // clone the term, and add to the set of seen terms. char saved[] = new char[length]; System.arraycopy(term, 0, saved, 0, length); previous.add(saved); if (!duplicate) { return true; } } return false; }