public class CmsSearchCategoryCollector
extends org.apache.lucene.search.Collector
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.
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
UNKNOWN_CATEGORY
Category used in case the document belongs to no category.
|
构造器和说明 |
---|
CmsSearchCategoryCollector(org.apache.lucene.search.IndexSearcher searcher)
Creates a new category search collector instance.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
acceptsDocsOutOfOrder() |
void |
collect(int id) |
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).
|
void |
setNextReader(org.apache.lucene.index.AtomicReaderContext ctx) |
void |
setScorer(org.apache.lucene.search.Scorer arg0) |
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 boolean acceptsDocsOutOfOrder()
acceptsDocsOutOfOrder
在类中 org.apache.lucene.search.Collector
Collector.acceptsDocsOutOfOrder()
public void collect(int id)
collect
在类中 org.apache.lucene.search.Collector
Collector.collect(int)
public java.util.Map<java.lang.String,java.lang.Integer> getCategoryCountResult()
public void setNextReader(org.apache.lucene.index.AtomicReaderContext ctx)
setNextReader
在类中 org.apache.lucene.search.Collector
Collector.setNextReader(org.apache.lucene.index.AtomicReaderContext)
public void setScorer(org.apache.lucene.search.Scorer arg0)
setScorer
在类中 org.apache.lucene.search.Collector
Collector.setScorer(org.apache.lucene.search.Scorer)
public java.lang.String toString()
toString
在类中 java.lang.Object
Object.toString()