@PublicSpi public abstract class

AbstractCustomFieldIndexer

extends Object
implements FieldIndexer
java.lang.Object
   ↳ com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer
Known Direct Subclasses

@PublicSpi

This class is designed for plugins to implement.

Clients of @PublicSpi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicSpi as per each product's API policy (clients should refer to each product's API policy for the exact guarantee -- usually binary compatibility is guaranteed at least across minor versions).

Note: @PublicSpi interfaces and classes are specifically designed to be implemented/extended by clients. Hence, the guarantee of binary compatibility is different to that of @PublicApi elements (if an element is both @PublicApi and @PublicSpi, both guarantees apply).

Class Overview

A base-class for custom field indexers that performs the logic of checking if the CustomField isVisibleAndInScope and then delegates off to the base class to add the correct document fields.

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.issue.index.indexers.FieldIndexer
Fields
protected final CustomField customField
Protected Constructors
AbstractCustomFieldIndexer(FieldVisibilityManager fieldVisibilityManager, CustomField customField)
Public Methods
abstract void addDocumentFieldsNotSearchable(Document doc, Issue issue)
abstract void addDocumentFieldsSearchable(Document doc, Issue issue)
final void addIndex(Document doc, Issue issue)
This method allows an indexer the opportunity to modifiy the provided Lucene document (by reference) such that it will contain fields that are relevant for searching and storage of the portion of the issue that the FieldIndexer handles.
String getDocumentFieldId()
String getId()
boolean isFieldVisibleAndInScope(Issue issue)
This method is used to determine if the indexer is relevant for the provided issue.
Protected Methods
boolean isRelevantForIssue(Issue issue)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.index.indexers.FieldIndexer

Fields

protected final CustomField customField

Protected Constructors

protected AbstractCustomFieldIndexer (FieldVisibilityManager fieldVisibilityManager, CustomField customField)

Public Methods

public abstract void addDocumentFieldsNotSearchable (Document doc, Issue issue)

public abstract void addDocumentFieldsSearchable (Document doc, Issue issue)

public final void addIndex (Document doc, Issue issue)

This method allows an indexer the opportunity to modifiy the provided Lucene document (by reference) such that it will contain fields that are relevant for searching and storage of the portion of the issue that the FieldIndexer handles. If calling isFieldVisibleAndInScope(com.atlassian.jira.issue.Issue) returns false then this method should create fields that have an Indexed type of NO. This allows us to store the value in the index but renderes its value unsearchable. If, for example, the indexer handles indexing an issues summary then this indexer will add a field to the document that represents the stored and searchable summary of the issue.

Parameters
doc the lucene document that should be modified by adding relevant fields to.
issue the issue that contains the data that will be indexed and which can be used to determine the project/issue type context that will allow you to determine if we should add the value as searchable or unsearchable.

public String getDocumentFieldId ()

public String getId ()

public boolean isFieldVisibleAndInScope (Issue issue)

This method is used to determine if the indexer is relevant for the provided issue. This method must check the fields visibility, in relation to the field configuration scheme, must check any global flags that would enable or disable a field (such as enable votes flag), and must check, if the field is a custom field, if the custom field is relevant for this issue. All these checks should take into account the IssueContext as defined by the passed in issue. If this method returns false then the FieldIndexer, when performing addIndex, should make sure to make the indexed values have an Indexed type of NO. The result of this method is used to determine the correct values that should be returned when performing an empty search.

Parameters
issue that is having a document created from.
Returns
  • if true then this field is relevant for the issue, otherwise it is not.

Protected Methods

protected boolean isRelevantForIssue (Issue issue)