Class VisibilityBaseFieldIndexer

java.lang.Object
com.atlassian.jira.search.issue.index.indexers.impl.VisibilityBaseFieldIndexer
All Implemented Interfaces:
FieldIndexer
Direct Known Subclasses:
AffectedVersionsIndexer, BaseLabelsIndexer, ComponentsIndexer, CreatorIndexer, CurrentEstimateIndexer, DescriptionIndexer, EnvironmentIndexer, FixForVersionsIndexer, OriginalEstimateIndexer, ParentIssueIndexer, PriorityIndexer, ProgressIndexer, ResolutionIndexer, StatusIndexer, TimeSpentIndexer, VoterIndexer, VotesIndexer, WatcherIndexer, WatchesIndexer, WorkRatioIndexer

@PublicSpi public abstract class VisibilityBaseFieldIndexer extends Object implements FieldIndexer
Base class for field indexers that only perform indexing when the associated fields are visible and in scope. This replaces com.atlassian.jira.issue.index.indexers.impl.BaseFieldIndexer
Since:
10.4
  • Field Details

  • Constructor Details

    • VisibilityBaseFieldIndexer

      protected VisibilityBaseFieldIndexer(FieldVisibilityManager fieldVisibilityManager)
  • Method Details

    • 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.

      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.
    • indexFields

      public void indexFields(FieldValueCollector collector, Issue issue, CustomFieldPrefetchedData prefetchedData)
      Description copied from interface: FieldIndexer
      This method allows an indexer the opportunity to add values to the provided collector that are relevant for searching and storage of the portion of the issue that the FieldIndexer handles.

      If, for example, the indexer handles indexing an issues summary then this indexer will add a field value to the collector that represents the stored and searchable summary of the issue.

      Note that trying to index very large (i.e. larger than ~32 kB) fields as KeywordField will result in them being removed to prevent the indexing operation from crashing. This is a limitation of how OpenSearch and Lucene store terms.

      Specified by:
      indexFields in interface FieldIndexer
      Parameters:
      collector - the collector for collecting indexed values
      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.
      prefetchedData - if the custom field type implemented CustomFieldType.getNonNullCustomFieldProvider() this reference will hold the matching value returned from NonNullCustomFieldProvider.getCustomFieldInfo(List <Issue>)
    • indexFieldsWithVisibility

      public void indexFieldsWithVisibility(FieldValueCollector collector, Issue issue, CustomFieldPrefetchedData prefetchedData, boolean visible)
      Description copied from interface: FieldIndexer
      The same as indexField but accepts an additional parameter to indicate if the field is visible and in scope. Thanks to that there is no need to call FieldIndexer.isFieldVisibleAndInScope(Issue) method inside. The default implementation is for backward compatibility. An indexer that wants to take advantage of performance gain should implement FieldWithVisibilityIndexer interface
      Specified by:
      indexFieldsWithVisibility in interface FieldIndexer
      Parameters:
      collector - the collector for collecting indexed values
      issue - that is having a document created from.
      prefetchedData - if the custom field type implemented CustomFieldType.getNonNullCustomFieldProvider() this reference will hold the matching value returned from NonNullCustomFieldProvider.getCustomFieldInfo(List <Issue>)*
    • indexVisibleFields

      protected abstract void indexVisibleFields(FieldValueCollector collector, Issue issue, CustomFieldPrefetchedData prefetchedData)