com.atlassian.jira.issue.index.indexers.impl
Class AbstractCustomFieldIndexer

java.lang.Object
  extended by com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer
All Implemented Interfaces:
FieldIndexer
Direct Known Subclasses:
CascadingSelectCustomFieldIndexer, CustomFieldLabelsIndexer, DateCustomFieldIndexer, ExactTextCustomFieldIndexer, GroupCustomFieldIndexer, LabelsCustomFieldIndexer, LocalDateIndexer, MultiSelectCustomFieldIndexer, NumberCustomFieldIndexer, ProjectCustomFieldIndexer, SelectCustomFieldIndexer, SortableTextCustomFieldIndexer, UserCustomFieldIndexer, VersionCustomFieldIndexer

@PublicSpi
public abstract class AbstractCustomFieldIndexer
extends Object
implements FieldIndexer

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.

Since:
v4.0

Field Summary
protected  CustomField customField
           
 
Fields inherited from interface com.atlassian.jira.issue.index.indexers.FieldIndexer
LABELS_NO_VALUE_INDEX_VALUE, NO_VALUE_INDEX_VALUE
 
Constructor Summary
protected AbstractCustomFieldIndexer(FieldVisibilityManager fieldVisibilityManager, CustomField customField)
           
 
Method Summary
abstract  void addDocumentFieldsNotSearchable(org.apache.lucene.document.Document doc, Issue issue)
           
abstract  void addDocumentFieldsSearchable(org.apache.lucene.document.Document doc, Issue issue)
           
 void addIndex(org.apache.lucene.document.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  boolean isRelevantForIssue(Issue issue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customField

protected final CustomField customField
Constructor Detail

AbstractCustomFieldIndexer

protected AbstractCustomFieldIndexer(FieldVisibilityManager fieldVisibilityManager,
                                     CustomField customField)
Method Detail

getId

public String getId()
Specified by:
getId in interface FieldIndexer
Returns:
the String representation of the field id that this indexer is indexing, this must be unique for each independant FieldIndexer. If the Indexer does not represent a System or Custom field in JIRA this should still return a unique string that describes the indexer.

getDocumentFieldId

public String getDocumentFieldId()
Specified by:
getDocumentFieldId in interface FieldIndexer
Returns:
the String representation of the primary field id that will be added to the Document as a result of a successful call to the FieldIndexer.addIndex(org.apache.lucene.document.Document, com.atlassian.jira.issue.Issue) method.

addDocumentFieldsSearchable

public abstract void addDocumentFieldsSearchable(org.apache.lucene.document.Document doc,
                                                 Issue issue)

addDocumentFieldsNotSearchable

public abstract void addDocumentFieldsNotSearchable(org.apache.lucene.document.Document doc,
                                                    Issue issue)

addIndex

public final void addIndex(org.apache.lucene.document.Document doc,
                           Issue issue)
Description copied from interface: FieldIndexer
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 FieldIndexer.isFieldVisibleAndInScope(com.atlassian.jira.issue.Issue) returns false then this method should create fields that have an Indexed type of Field.Index.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.

Specified by:
addIndex in interface FieldIndexer
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.

isFieldVisibleAndInScope

public boolean isFieldVisibleAndInScope(Issue issue)
Description copied from interface: FieldIndexer
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 Field.Index.NO. The result of this method is used to determine the correct values that should be returned when performing an empty search.

Specified by:
isFieldVisibleAndInScope in interface FieldIndexer
Parameters:
issue - that is having a document created from.
Returns:
if true then this field is relevant for the issue, otherwise it is not.

isRelevantForIssue

protected boolean isRelevantForIssue(Issue issue)


Copyright © 2002-2012 Atlassian. All Rights Reserved.