@Internal @NotThreadSafe public abstract class AbstractOneDimensionalHitCollector extends org.apache.lucene.search.SimpleCollector
This class implements Collector
which is a callback mechanism for use by
IndexSearcher
, but it is widely abused and called directly from within JIRA.
This class assumes the collected values will be sorted. This is not possible in the current API (SearchProvider
).
Users of this class should
- Retrieve the sorted document ids from Lucene
- Use doSetNextReader(LeafReaderContext)
or doSetNextIndexReader(IndexReaderContext)
to set context
- Feed sorted ids into collect(int)
method
This class is not thread-safe.
Constructor and Description |
---|
AbstractOneDimensionalHitCollector(String documentFieldId,
FieldVisibilityManager fieldVisibilityManager,
ReaderCache readerCache,
FieldManager fieldManager) |
Modifier and Type | Method and Description |
---|---|
void |
collect(int i)
Collect hits.
|
protected abstract void |
collectIrrelevant(int docId)
Implement this if you would like to do something when the hit collector has encountered a docId that contains an
irrelevant data match
|
protected abstract void |
collectWithTerms(int docId,
JiraBytesRef[] terms)
Implement this if you would like to do something with the hit we have found.
|
void |
doSetNextIndexReader(org.apache.lucene.index.IndexReaderContext context) |
void |
doSetNextReader(org.apache.lucene.index.LeafReaderContext context) |
long |
getHitCount()
Returns the number of times the
collect(int) method was called. |
long |
getIrrelevantCount() |
boolean |
needsScores() |
public AbstractOneDimensionalHitCollector(String documentFieldId, FieldVisibilityManager fieldVisibilityManager, ReaderCache readerCache, FieldManager fieldManager)
public void doSetNextReader(org.apache.lucene.index.LeafReaderContext context)
doSetNextReader
in class org.apache.lucene.search.SimpleCollector
public void doSetNextIndexReader(org.apache.lucene.index.IndexReaderContext context)
public void collect(int i)
collect
in interface org.apache.lucene.search.LeafCollector
collect
in class org.apache.lucene.search.SimpleCollector
i
- Index to the current readerpublic long getIrrelevantCount()
public long getHitCount()
collect(int)
method was called. This should return the number of
unique issues that was matched during a search.collect(int)
method was called.protected abstract void collectIrrelevant(int docId)
docId
- the match we have found. This is an index into the overall directory reader.protected abstract void collectWithTerms(int docId, JiraBytesRef[] terms)
docId
- the doc id of the hit. This is an index into the overall directory reader.terms
- the terms for the fieldId for this document, pre-calculated so you may not need to call getDocumentpublic boolean needsScores()
Copyright © 2002-2022 Atlassian. All Rights Reserved.