public abstract class DiversifiedTopDocsCollector extends TopDocsCollector<DiversifiedTopDocsCollector.ScoreDocKey>
TopDocsCollector
that controls diversity in results by ensuring no
more than maxHitsPerKey results from a common source are collected in the
final results.
An example application might be a product search in a marketplace where no
more than 3 results per retailer are permitted in search results.
To compare behaviour with other forms of collector, a useful analogy might be the problem of making a compilation album of 1967's top hit records:
Modifier and Type | Class and Description |
---|---|
static class |
DiversifiedTopDocsCollector.ScoreDocKey
An extension to ScoreDoc that includes a key used for grouping purposes
|
Modifier and Type | Field and Description |
---|---|
protected int |
maxNumPerKey |
EMPTY_TOPDOCS, pq, totalHits, totalHitsRelation
Constructor and Description |
---|
DiversifiedTopDocsCollector(int numHits,
int maxHitsPerKey) |
Modifier and Type | Method and Description |
---|---|
protected abstract NumericDocValues |
getKeys(LeafReaderContext context)
Get a source of values used for grouping keys
|
LeafCollector |
getLeafCollector(LeafReaderContext context) |
protected DiversifiedTopDocsCollector.ScoreDocKey |
insert(DiversifiedTopDocsCollector.ScoreDocKey addition,
int docBase,
NumericDocValues keys) |
protected TopDocs |
newTopDocs(ScoreDoc[] results,
int start) |
ScoreMode |
scoreMode() |
getTotalHits, populateResults, topDocs, topDocs, topDocs, topDocsSize
public DiversifiedTopDocsCollector(int numHits, int maxHitsPerKey)
protected abstract NumericDocValues getKeys(LeafReaderContext context)
public ScoreMode scoreMode()
protected TopDocs newTopDocs(ScoreDoc[] results, int start)
newTopDocs
in class TopDocsCollector<DiversifiedTopDocsCollector.ScoreDocKey>
protected DiversifiedTopDocsCollector.ScoreDocKey insert(DiversifiedTopDocsCollector.ScoreDocKey addition, int docBase, NumericDocValues keys) throws IOException
IOException
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.