本文整理匯總了Java中org.apache.lucene.search.Collector.setScorer方法的典型用法代碼示例。如果您正苦於以下問題:Java Collector.setScorer方法的具體用法?Java Collector.setScorer怎麽用?Java Collector.setScorer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.lucene.search.Collector
的用法示例。
在下文中一共展示了Collector.setScorer方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: score
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
@Override
public boolean score(Collector collector, int max) throws IOException {
FakeScorer fakeScorer = new FakeScorer();
collector.setScorer(fakeScorer);
if (doc == -1) {
doc = nextDocOutOfOrder();
}
while(doc < max) {
fakeScorer.doc = doc;
fakeScorer.score = scores[ords[scoreUpto]];
collector.collect(doc);
doc = nextDocOutOfOrder();
}
return doc != DocsEnum.NO_MORE_DOCS;
}
示例2: testNullCollectors
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
@Test
public void testNullCollectors() throws Exception {
// Tests that the collector rejects all null collectors.
try {
MultiCollector.wrap(null, null);
fail("only null collectors should not be supported");
} catch (IllegalArgumentException e) {
// expected
}
// Tests that the collector handles some null collectors well. If it
// doesn't, an NPE would be thrown.
Collector c = MultiCollector.wrap(new DummyCollector(), null, new DummyCollector());
assertTrue(c instanceof MultiCollector);
assertTrue(c.acceptsDocsOutOfOrder());
c.collect(1);
c.setNextReader(null);
c.setScorer(null);
}
示例3: testCollector
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
@Test
public void testCollector() throws Exception {
// Tests that the collector delegates calls to input collectors properly.
// Tests that the collector handles some null collectors well. If it
// doesn't, an NPE would be thrown.
DummyCollector[] dcs = new DummyCollector[] { new DummyCollector(), new DummyCollector() };
Collector c = MultiCollector.wrap(dcs);
assertTrue(c.acceptsDocsOutOfOrder());
c.collect(1);
c.setNextReader(null);
c.setScorer(null);
for (DummyCollector dc : dcs) {
assertTrue(dc.acceptsDocsOutOfOrderCalled);
assertTrue(dc.collectCalled);
assertTrue(dc.setNextReaderCalled);
assertTrue(dc.setScorerCalled);
}
}
示例4: getSecureCollector
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
protected Collector getSecureCollector(final Collector collector) {
return new Collector() {
@Override
public void setScorer(Scorer scorer) throws IOException {
collector.setScorer(scorer);
}
@Override
public void setNextReader(AtomicReaderContext context) throws IOException {
Object key = context.reader().getCoreCacheKey();
AtomicReaderContext atomicReaderContext = _leaveMap.get(key);
collector.setNextReader(atomicReaderContext);
}
@Override
public void collect(int doc) throws IOException {
collector.collect(doc);
}
@Override
public boolean acceptsDocsOutOfOrder() {
return collector.acceptsDocsOutOfOrder();
}
};
}
示例5: score
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
/**
* Scores and collects all matching documents.
*
* @param collector
* The collector to which all matching documents are passed
* through.
*/
@Override
public void score(Collector collector) throws IOException {
collector.setScorer(this);
while ((doc = countingSumScorer.nextDoc()) != NO_MORE_DOCS) {
collector.collect(doc);
}
}
示例6: score
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
@Override
public void score(Collector collector) throws IOException {
collector.setScorer(this);
for (int doc = nextDocOutOfOrder(); doc != NO_MORE_DOCS; doc = nextDocOutOfOrder()) {
collector.collect(doc);
}
}
示例7: setScorer
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
@Override
public void setScorer(Scorer s) throws IOException {
for (Collector c : collectors) {
c.setScorer(s);
}
}
示例8: setScorer
import org.apache.lucene.search.Collector; //導入方法依賴的package包/類
public void setScorer(Scorer scorer) throws IOException {
for (Collector c : collectors) {
c.setScorer(scorer);
}
}