List of usage examples for org.apache.lucene.search LeafCollector setScorer
void setScorer(Scorable scorer) throws IOException;
From source file:org.elasticsearch.search.profile.ProfileTests.java
License:Apache License
public void testCollector() throws IOException { TotalHitCountCollector collector = new TotalHitCountCollector(); ProfileCollector profileCollector = new ProfileCollector(collector); assertEquals(0, profileCollector.getTime()); final LeafCollector leafCollector = profileCollector.getLeafCollector(reader.leaves().get(0)); assertThat(profileCollector.getTime(), greaterThan(0L)); long time = profileCollector.getTime(); leafCollector.setScorer(Lucene.illegalScorer("dummy scorer")); assertThat(profileCollector.getTime(), greaterThan(time)); time = profileCollector.getTime();//from w w w . j a v a2s.co m leafCollector.collect(0); assertThat(profileCollector.getTime(), greaterThan(time)); }
From source file:org.elasticsearch.search.profile.query.ProfileTests.java
License:Apache License
public void testCollector() throws IOException { TotalHitCountCollector collector = new TotalHitCountCollector(); ProfileCollector profileCollector = new ProfileCollector(collector); assertEquals(0, profileCollector.getTime()); final LeafCollector leafCollector = profileCollector.getLeafCollector(reader.leaves().get(0)); assertThat(profileCollector.getTime(), greaterThan(0L)); long time = profileCollector.getTime(); leafCollector.setScorer(null); assertThat(profileCollector.getTime(), greaterThan(time)); time = profileCollector.getTime();//from ww w. j av a 2 s .c om leafCollector.collect(0); assertThat(profileCollector.getTime(), greaterThan(time)); }
From source file:org.neo4j.kernel.api.impl.index.collector.DocValuesCollector.java
License:Open Source License
private void replayTo(Collector collector) throws IOException { for (MatchingDocs docs : getMatchingDocs()) { LeafCollector leafCollector = collector.getLeafCollector(docs.context); Scorer scorer;/*w w w . j a v a2 s . co m*/ DocIdSetIterator idIterator = docs.docIdSet.iterator(); if (isKeepScores()) { scorer = new ReplayingScorer(docs.scores); } else { scorer = new ConstantScoreScorer(null, Float.NaN, idIterator); } leafCollector.setScorer(scorer); int doc; while ((doc = idIterator.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { leafCollector.collect(doc); } } }
From source file:org.neo4j.kernel.api.impl.index.DocValuesCollector.java
License:Open Source License
private void replayTo(Collector collector) throws IOException { for (MatchingDocs docs : getMatchingDocs()) { LeafCollector leafCollector = collector.getLeafCollector(docs.context); Scorer scorer;/*from w ww.j ava2s. com*/ DocIdSetIterator disi = docs.docIdSet.iterator(); if (isKeepScores()) { scorer = new ReplayingScorer(docs.scores); } else { scorer = new ConstantScoreScorer(null, Float.NaN, disi); } leafCollector.setScorer(scorer); int doc; while ((doc = disi.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { leafCollector.collect(doc); } } }