|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.search.Collector
org.weborganic.flint.search.DocumentCounter
public final class DocumentCounter
Simply counts the number of documents in search results.
Typical usage:
// creates a document counter DocumentCounter counter = new DocumentCounter(); // make a search searcher.search(query, counter); // get the final count int numberOfDocuments = counter.getCount();
Constructor Summary | |
---|---|
DocumentCounter()
Creates a new document counter. |
Method Summary | |
---|---|
boolean |
acceptsDocsOutOfOrder()
Accept documents out of order - the order is irrelevant when counting. |
void |
collect(int doc)
Increase the document count. |
int |
getCount()
Returns the number of documents counted after a search. |
void |
reset()
Resets this document counter for reuse by resetting the count to zero. |
void |
setNextReader(IndexReader reader,
int docbase)
Does nothing - the scorer is irrelevant when counting documents. |
void |
setScorer(Scorer scorer)
Does nothing - the scorer is irrelevant when counting documents. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DocumentCounter()
Method Detail |
---|
public void setScorer(Scorer scorer)
setScorer
in class Collector
scorer
- the scorer.public boolean acceptsDocsOutOfOrder()
acceptsDocsOutOfOrder
in class Collector
true
.public void collect(int doc)
collect
in class Collector
doc
- the position of the Lucene Document
in the indexpublic void setNextReader(IndexReader reader, int docbase)
setNextReader
in class Collector
reader
- the next index readerdocbase
- used to re-base document ids for the index.public int getCount()
public void reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |