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

java.lang.Object
  extended by com.atlassian.jira.issue.index.indexers.impl.BaseFieldIndexer
All Implemented Interfaces:
FieldIndexer
Direct Known Subclasses:
AffectedVersionsIndexer, AttachmentIndexer, ComponentsIndexer, CreatedDateIndexer, CurrentEstimateIndexer, DescriptionIndexer, DueDateIndexer, EnvironmentIndexer, FixForVersionsIndexer, IssueIdIndexer, IssueKeyIndexer, IssueTypeIndexer, LabelsIndexer, OriginalEstimateIndexer, ParentIssueIndexer, PriorityIndexer, ProjectIdIndexer, ResolutionDateIndexer, ResolutionIndexer, SecurityIndexer, StatusIndexer, SubTaskIndexer, SummaryIndexer, TimeSpentIndexer, UpdatedDateIndexer, UserFieldIndexer, VotesIndexer, WatchesIndexer, WorkRatioIndexer

public abstract class BaseFieldIndexer
extends Object
implements FieldIndexer


Field Summary
 
Fields inherited from interface com.atlassian.jira.issue.index.indexers.FieldIndexer
LABELS_NO_VALUE_INDEX_VALUE, NO_VALUE_INDEX_VALUE
 
Constructor Summary
protected BaseFieldIndexer(FieldVisibilityManager fieldVisibilityManager)
           
 
Method Summary
 int compareTo(Object obj)
           
 boolean equals(Object o)
           
 int hashCode()
           
 void indexDateField(org.apache.lucene.document.Document doc, String indexField, Timestamp date, Issue issue)
          Index a single keyword field, with a date-time value
 void indexDependentEntities(Issue issue, org.apache.lucene.document.Document doc, String associationType, String indexField)
          Index the dependent entities of an issue.
 void indexFoldedKeyword(org.apache.lucene.document.Document doc, String indexField, String fieldValue, Locale locale, Issue issue)
          Case fold the passed keyword and add it to the passed document.
 void indexKeyword(org.apache.lucene.document.Document doc, String indexField, String fieldValue, Issue issue)
          Index a single keyword field
 void indexKeywordWithDefault(org.apache.lucene.document.Document doc, String indexField, Long aLong, String defaultValue, Issue issue)
           
 void indexKeywordWithDefault(org.apache.lucene.document.Document doc, String indexField, String fieldValue, String defaultValue, Issue issue)
          Index a single keyword field, with a default if the issue field is not set shared with CommentDocumentFactory
 void indexLocalDateField(org.apache.lucene.document.Document doc, String indexField, LocalDate localDate, Issue issue)
          Index a single keyword field, with a LocalDate value
 void indexLongAsKeyword(org.apache.lucene.document.Document doc, String indexField, Long fieldValue, Issue issue)
           
 void indexLongAsPaddedKeywordWithDefault(org.apache.lucene.document.Document doc, String indexField, Long aLong, Long defaultLong, Issue issue)
          Useful for storing a Long value for range query searches.
 void indexLongAsPaddedKeywordWithDefault(org.apache.lucene.document.Document doc, String indexField, Long aLong, String defaultValue, Issue issue)
          Useful for storing a Long value for range query searches.
 void indexText(org.apache.lucene.document.Document doc, String indexField, String fieldValue, Issue issue)
          Index a single text field
 void indexTextForSorting(org.apache.lucene.document.Document doc, String indexField, String fieldValue, Issue issue)
          Index a single text field
 boolean isFieldVisibleAndInScope(Issue issue)
          This method is used to determine if the indexer is relevant for the provided issue.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.jira.issue.index.indexers.FieldIndexer
addIndex, getDocumentFieldId, getId
 

Constructor Detail

BaseFieldIndexer

protected BaseFieldIndexer(FieldVisibilityManager fieldVisibilityManager)
Method Detail

indexKeyword

public void indexKeyword(org.apache.lucene.document.Document doc,
                         String indexField,
                         String fieldValue,
                         Issue issue)
Index a single keyword field

Parameters:
doc - the document to add the field to.
indexField - the document field name to user.
fieldValue - the value to index. This value will NOT be folded before adding it to the document.
issue - the issue that defines the context and contains the value we are indexing.

indexFoldedKeyword

public void indexFoldedKeyword(org.apache.lucene.document.Document doc,
                               String indexField,
                               String fieldValue,
                               Locale locale,
                               Issue issue)
Case fold the passed keyword and add it to the passed document.

Parameters:
doc - the document to add the field to.
indexField - the document field name to use.
fieldValue - the value to index. This value will be folded before adding it to the document.
locale - the locale to use in the case folding. Null can be passed to use the Locale given in Locale.getDefault().
issue - the issue that defines the context and contains the value we are indexing.
See Also:
CaseFolding

indexKeywordWithDefault

public void indexKeywordWithDefault(org.apache.lucene.document.Document doc,
                                    String indexField,
                                    String fieldValue,
                                    String defaultValue,
                                    Issue issue)
Index a single keyword field, with a default if the issue field is not set shared with CommentDocumentFactory


indexKeywordWithDefault

public void indexKeywordWithDefault(org.apache.lucene.document.Document doc,
                                    String indexField,
                                    Long aLong,
                                    String defaultValue,
                                    Issue issue)

indexLongAsPaddedKeywordWithDefault

public void indexLongAsPaddedKeywordWithDefault(org.apache.lucene.document.Document doc,
                                                String indexField,
                                                Long aLong,
                                                String defaultValue,
                                                Issue issue)
Useful for storing a Long value for range query searches. Uses NumberTools.longToString(long) to pad and convert the value to base 36 before indexing. Does not pad the default value.

Parameters:
doc - the document
indexField - the index field id
aLong - the long value to be converted
defaultValue - the default value if aLong is null
issue - the issue that defines the context and contains the value we are indexing.

indexLongAsPaddedKeywordWithDefault

public void indexLongAsPaddedKeywordWithDefault(org.apache.lucene.document.Document doc,
                                                String indexField,
                                                Long aLong,
                                                Long defaultLong,
                                                Issue issue)
Useful for storing a Long value for range query searches. Uses NumberTools.longToString(long) to pad and convert the values to base 36 before indexing. Also pads and converts the default Value.

Parameters:
doc - the document
indexField - the index field id
aLong - the long value to be converted
defaultLong - the default value if aLong is null
issue - the issue that defines the context and contains the value we are indexing.

indexText

public void indexText(org.apache.lucene.document.Document doc,
                      String indexField,
                      String fieldValue,
                      Issue issue)
Index a single text field


indexDateField

public void indexDateField(org.apache.lucene.document.Document doc,
                           String indexField,
                           Timestamp date,
                           Issue issue)
Index a single keyword field, with a date-time value


indexLocalDateField

public void indexLocalDateField(org.apache.lucene.document.Document doc,
                                String indexField,
                                LocalDate localDate,
                                Issue issue)
Index a single keyword field, with a LocalDate value


indexDependentEntities

public void indexDependentEntities(Issue issue,
                                   org.apache.lucene.document.Document doc,
                                   String associationType,
                                   String indexField)
Index the dependent entities of an issue.


indexLongAsKeyword

public void indexLongAsKeyword(org.apache.lucene.document.Document doc,
                               String indexField,
                               Long fieldValue,
                               Issue issue)

indexTextForSorting

public void indexTextForSorting(org.apache.lucene.document.Document doc,
                                String indexField,
                                String fieldValue,
                                Issue issue)
Index a single text field


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Object obj)

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.


Copyright © 2002-2014 Atlassian. All Rights Reserved.