com.atlassian.jira.issue.search.parameters.lucene.sort
Class DefaultMatchHandler
java.lang.Object
com.atlassian.jira.issue.search.parameters.lucene.sort.DefaultMatchHandler
- All Implemented Interfaces:
- MatchHandler
@ExperimentalApi
public class DefaultMatchHandler
- extends Object
- implements MatchHandler
The default match handler used by 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.
- Since:
- v5.1
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultMatchHandler
public DefaultMatchHandler(int maxdoc)
handleMatchedDocument
public void handleMatchedDocument(int doc,
String termValue)
- Description copied from interface:
MatchHandler
- Invoked by
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.
- Specified by:
handleMatchedDocument
in interface MatchHandler
- Parameters:
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.
getResults
public List<String>[] getResults()
Copyright © 2002-2013 Atlassian. All Rights Reserved.