public class DefaultMatchHandler extends Object implements MatchHandler
JiraLuceneFieldFinder.getMatches(org.apache.lucene.index.IndexReader, String)
.
Builds an array of collections of strings, where the array index is the document number and the collection contains the values for that term. In JIRA's terms, the array index is a key for looking up an issue and the collection contains the values assigned to the field we are matching against.
This array built here is a memory eating monster and we take special care to eat as little as possible. This matcher labours under the assumption that nearly all documents have single values for most terms, even in the case of multi-valued fields, such as component or fixVersion, most documents have only a single value, often the empty value, "-1".
We use a shared singleton for any single values and only build a mutable collection once we go past a single value. This has no performance cost even in the case where there are > 1 values, aside from the size() == 1 comparison.
Constructor and Description |
---|
DefaultMatchHandler(int maxdoc) |
Modifier and Type | Method and Description |
---|---|
List<String>[] |
getResults() |
void |
handleMatchedDocument(int doc,
String termValue)
Invoked by
JiraLuceneFieldFinder.getMatches(org.apache.lucene.index.IndexReader, String, MatchHandler)
for each field value for each document. |
public void handleMatchedDocument(int doc, String termValue)
MatchHandler
JiraLuceneFieldFinder.getMatches(org.apache.lucene.index.IndexReader, String, MatchHandler)
for each field value for each document. The calls will be made in
order of increasing term values, with the document identifiers supplied
in an arbitrary order.handleMatchedDocument
in interface MatchHandler
doc
- the document identifier for the document that contains the term. In
JIRA, this indentifies a particular issuetermValue
- the value assigned to the term. In JIRA, this is the value
assigned to the field.Copyright © 2002-2022 Atlassian. All Rights Reserved.