@ExperimentalApi public class

DefaultMatchHandler

extends Object
implements MatchHandler
java.lang.Object
   ↳ com.atlassian.jira.issue.search.parameters.lucene.sort.DefaultMatchHandler

@ExperimentalApi

This class is considered usable by external developers but its contracts have not stabilized.

Experimental APIs may be changed at any time before being marked @Internal or @PublicApi.

Class Overview

The default match handler used by 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.

Summary

Public Constructors
DefaultMatchHandler(int maxdoc)
Public Methods
List[]<String> getResults()
void handleMatchedDocument(int doc, String termValue)
Invoked by getMatches(org.apache.lucene.index.IndexReader, String, MatchHandler) for each field value for each document.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.search.parameters.lucene.sort.MatchHandler

Public Constructors

public DefaultMatchHandler (int maxdoc)

Public Methods

public List[]<String> getResults ()

public void handleMatchedDocument (int doc, String termValue)

Invoked by 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.

Parameters
doc the document identifier for the document that contains the term. In JIRA, this indentifies a particular issue
termValue the value assigned to the term. In JIRA, this is the value assigned to the field.