public class CmsSearchCategoryCollector extends org.apache.lucene.search.SimpleCollector
Please note: The calculation of the category count slows down the search time by an order of magnitude. Make sure that you only use this feature if it's really required! Be especially careful if your search result list can become large (> 1000 documents), since in this case overall system performance will certainly be impacted considerably when calculating the categories.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
UNKNOWN_CATEGORY
Category used in case the document belongs to no category.
|
| Constructor and Description |
|---|
CmsSearchCategoryCollector(org.apache.lucene.search.IndexSearcher searcher)
Creates a new category search collector instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collect(int id) |
protected void |
doSetNextReader(org.apache.lucene.index.LeafReaderContext ctx) |
static java.lang.String |
formatCategoryMap(java.util.Map<java.lang.String,java.lang.Integer> categories)
Convenience method to format a map of categories in a nice 2 column list, for example
for display of debugging output.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getCategoryCountResult()
Returns the category count result, the returned map
contains Strings (category names) mapped to an Integer (the count).
|
org.apache.lucene.search.ScoreMode |
scoreMode() |
java.lang.String |
toString() |
public static final java.lang.String UNKNOWN_CATEGORY
public CmsSearchCategoryCollector(org.apache.lucene.search.IndexSearcher searcher)
searcher - the index searcher usedpublic static final java.lang.String formatCategoryMap(java.util.Map<java.lang.String,java.lang.Integer> categories)
categories - the map to formatpublic void collect(int id)
collect in interface org.apache.lucene.search.LeafCollectorcollect in class org.apache.lucene.search.SimpleCollectorSimpleCollector.collect(int)public java.util.Map<java.lang.String,java.lang.Integer> getCategoryCountResult()
public org.apache.lucene.search.ScoreMode scoreMode()
Collector.scoreMode()public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()protected void doSetNextReader(org.apache.lucene.index.LeafReaderContext ctx)
doSetNextReader in class org.apache.lucene.search.SimpleCollectorSimpleCollector.doSetNextReader(org.apache.lucene.index.LeafReaderContext)