/** * {@inheritDoc} */ public int next() throws IOException { int docId = scorer.nextDoc(); if (docId != DocIdSetIterator.NO_MORE_DOCS) { return docId; } else { return -1; } }
@Override public int nextDoc() throws IOException { return _innerScorer.nextDoc(); }
/** * {@inheritDoc} */ public int next() throws IOException { int docId = scorer.nextDoc(); if (docId != DocIdSetIterator.NO_MORE_DOCS) { return docId; } else { return -1; } }
@Override public int nextDoc() throws IOException { return (_docid = _innerScorer.nextDoc()); }
@Override public int nextDoc() throws IOException { return scorer.nextDoc(); }
@Override public int nextDoc() throws IOException { return _innerScorer.nextDoc(); }
@Override public int nextDoc() throws IOException { return innerScorer.nextDoc(); }
/** * {@inheritDoc} */ public int next() throws IOException { int docId = scorer.nextDoc(); if (docId != DocIdSetIterator.NO_MORE_DOCS) { return docId; } else { return -1; } }
@Override public int nextDoc() throws IOException { while (currentDoc != NO_MORE_DOCS) { if (scorers[currentScorer] != null && scorers[currentScorer].nextDoc() != NO_MORE_DOCS) { currentDoc = scorers[currentScorer].docID() + starts[currentScorer]; return currentDoc; } else if (++currentScorer < scorers.length) { // advance to next scorer } else { // no more scorers currentDoc = NO_MORE_DOCS; } } return currentDoc; }
@Override public int nextDoc() throws IOException { while (currentDoc != NO_MORE_DOCS) { if (scorers[currentScorer] != null && scorers[currentScorer].nextDoc() != NO_MORE_DOCS) { currentDoc = scorers[currentScorer].docID() + starts[currentScorer]; return currentDoc; } else if (++currentScorer < scorers.length) { // advance to next scorer } else { // no more scorers currentDoc = NO_MORE_DOCS; } } return currentDoc; }
/** * Note: this returns docIDs that must be interpreted relative to the current leaf reader: * these are not offset by the leaf.docBase. */ @Override public int nextDoc() throws IOException { while (scorer != null) { docID = scorer.nextDoc(); if (docID != NO_MORE_DOCS) { return docID; } advanceScorer(); } return NO_MORE_DOCS; }
@Override public int nextDoc() throws IOException { while (currentDoc != NO_MORE_DOCS) { if (scorers[currentScorer].nextDoc() != NO_MORE_DOCS) { currentDoc = scorers[currentScorer].docID() + starts[currentScorer]; return currentDoc; } else if (++currentScorer < scorers.length) { // advance to next scorer } else { // no more scorers currentDoc = NO_MORE_DOCS; } } return currentDoc; }
@Override public int nextDoc() throws IOException { for (;;) { int docId = scorer.nextDoc(); if (docId == DocIdSetIterator.NO_MORE_DOCS || predicate.get(scorer.docID())) { return docId; } } }
/** * {@inheritDoc} */ public ScoreNode nextScoreNode() throws IOException { if (scorer == null) { return null; } int doc = scorer.nextDoc(); if (doc == DocIdSetIterator.NO_MORE_DOCS) { return null; } String uuid = reader.document(doc).get(FieldNames.UUID); return new ScoreNode(uuid, scorer.score(), doc); }
/** * {@inheritDoc} */ public ScoreNode nextScoreNode() throws IOException { if (scorer == null) { return null; } int doc = scorer.nextDoc(); if (doc == DocIdSetIterator.NO_MORE_DOCS) { return null; } NodeId id = new NodeId(reader.document( doc, FieldSelectors.UUID).get(FieldNames.UUID)); return new ScoreNode(id, scorer.score(), doc); }
/** * {@inheritDoc} */ public ScoreNode nextScoreNode() throws IOException { if (scorer == null) { return null; } int doc = scorer.nextDoc(); if (doc == DocIdSetIterator.NO_MORE_DOCS) { return null; } NodeId id = new NodeId(reader.document( doc, FieldSelectors.UUID).get(FieldNames.UUID)); return new ScoreNode(id, scorer.score(), doc); }
/** * {@inheritDoc} */ @Override public int advance(int target) throws IOException { if (currentDoc == NO_MORE_DOCS) { return currentDoc; } currentDoc = subScorer.nextDoc(); if (currentDoc == NO_MORE_DOCS) { return NO_MORE_DOCS; } else { collectContextHits(); return isValid(currentDoc) ? currentDoc : nextDoc(); } }
@Test public void testAdvanceInfiniteLoop() throws Exception { this.addDocuments( "{ \"baba\" : \"bibi ccc\" , \"ccc\" \"bbb ccc\" }", "{ \"baba bibi baba bibi\" : \"aaa bbb ddd\" }", "{ \"baba bibi\" : \"aaa bbb ddd\" }" ); final Scorer scorer1 = this.getScorer( nbq(must("baba", "bibi")).getLuceneProxyQuery() ); assertTrue(scorer1.advance(0) != DocIdSetIterator.NO_MORE_DOCS); assertEquals(1, scorer1.docID()); assertEquals(2, scorer1.freq(), 0); final float score1 = scorer1.score(); assertTrue(scorer1.nextDoc() != DocIdSetIterator.NO_MORE_DOCS); assertEquals(2, scorer1.docID()); assertEquals(2, scorer1.freq(), 0); final float score2 = scorer1.score(); assertTrue(score1 > score2); assertTrue(scorer1.nextDoc() == DocIdSetIterator.NO_MORE_DOCS); }
@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); }
@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); }