/** * {@inheritDoc} */ public void close() throws IOException { if (scorer != null) { // make sure scorer frees resources scorer.advance(Integer.MAX_VALUE); } }
/** * {@inheritDoc} */ public void close() throws IOException { if (scorer != null) { // make sure scorer frees resources scorer.advance(Integer.MAX_VALUE); } }
/** * {@inheritDoc} */ public int advance(int target) throws IOException { return childScorer.advance(target); }
@Override public int advance(int target) throws IOException { return innerScorer.advance(target); }
/** * {@inheritDoc} */ public int skipTo(int target) throws IOException { int docId = scorer.advance(target); if (docId != DocIdSetIterator.NO_MORE_DOCS) { return docId; } else { return -1; } } }
/** * {@inheritDoc} */ public int skipTo(int target) throws IOException { int docId = scorer.advance(target); if (docId != DocIdSetIterator.NO_MORE_DOCS) { return docId; } else { return -1; } } }
@Override public int advance(int target) throws IOException { return scorer.advance(target); }
@Override public int advance(int target) throws IOException { return (_docid = _innerScorer.advance(target)); }
@Override public int advance(int target) throws IOException { return currentContextScorer.advance(target); } }
@Override public int advance(int target) throws IOException { return _innerScorer.advance(target); }
@Override public int advance(int target) throws IOException { return _innerScorer.advance(target); }
/** * {@inheritDoc} */ public int skipTo(int target) throws IOException { int docId = scorer.advance(target); if (docId != DocIdSetIterator.NO_MORE_DOCS) { return docId; } else { return -1; } } }
@Override public int advance(int target) throws IOException { if (docNo == NO_MORE_DOCS) { return docNo; } // optimize in the case of an advance to finish. // see https://issues.apache.org/jira/browse/JCR-3091 if (target == NO_MORE_DOCS) { contextScorer.advance(target); docNo = NO_MORE_DOCS; return docNo; } if (contextNo != -1 && contextNo < target) { int docId = contextScorer.advance(target); contextNo = docId == NO_MORE_DOCS ? -1 : docId; } docNo = target - 1; return nextDoc(); }
/** * {@inheritDoc} */ public void close() throws IOException { // make sure scorer and filter free resources if (scorer != null) { scorer.advance(Integer.MAX_VALUE); } if (filter != null) { filter.advance(Integer.MAX_VALUE); } }
@Override public int advance(int target) throws IOException { while (scorer != null) { docID = scorer.advance(target - leaf.docBase); if (docID != NO_MORE_DOCS) { return docID + leaf.docBase; } advanceScorer(); } return NO_MORE_DOCS; }
/** * {@inheritDoc} */ public void close() throws IOException { if (scorer != null) { // make sure scorer frees resources scorer.advance(Integer.MAX_VALUE); } if (releaseReaderOnClose && reader != null && reader instanceof ReleaseableIndexReader) { ((ReleaseableIndexReader)reader).release(); } }
/** * {@inheritDoc} */ @Override public int advance(int target) throws IOException { if (docNo == NO_MORE_DOCS) { return docNo; } if (contextNo != -1 && contextNo < target) { int docId = contextScorer.advance(target); contextNo = docId == NO_MORE_DOCS ? -1 : docId; } docNo = target - 1; return nextDoc(); } }
@Override public int advance(final int target) throws IOException { scorer.advance(target); if (scorer.docID() == DocIdSetIterator.NO_MORE_DOCS || (scorer.docID() >= 0 && predicate.get(scorer.docID()))) { return scorer.docID(); } return nextDoc(); }
@Override public Explanation explain(AtomicReaderContext context, int doc) throws IOException { Scorer scorer = scorer(context, context.reader().getLiveDocs()); if (scorer != null) { int newDoc = scorer.advance(doc); if (newDoc == doc) { float score = scorer.score(); ComplexExplanation result = new ComplexExplanation(); result.setDescription("ImageHashLimitQuery, product of:"); result.setValue(score); if (getBoost() != 1.0f) { result.addDetail(new Explanation(getBoost(),"boost")); score = score / getBoost(); } result.addDetail(new Explanation(score ,"image score (1/distance)")); result.setMatch(true); return result; } } return new ComplexExplanation(false, 0.0f, "no matching term"); } }
@Test public void testAdvance() throws Exception { this.addDocuments( "{ \"baba\" : \"aaa ccc\" , \"ccc\" : \"bbb ccc\" }", "{ \"aaa\" : \"aaa bbb ddd\" }", "{ \"ddd\" : [ \"bobo\", \"bibi\" ] }" ); final Scorer scorer1 = this.getScorer( ntq("bobo").getLuceneProxyQuery() ); assertTrue(scorer1.advance(2) != DocIdSetIterator.NO_MORE_DOCS); assertEquals(2, scorer1.docID()); assertEquals(1, scorer1.freq(), 0); assertTrue(scorer1.nextDoc() == DocIdSetIterator.NO_MORE_DOCS); final Scorer scorer2 = this.getScorer( ntq("baba").getLuceneProxyQuery() ); assertTrue(scorer2.advance(2) == DocIdSetIterator.NO_MORE_DOCS); }