@PublicSpi
public interface FieldIndexer
Document
that is relevant for a JIRA
field.
The portion that is added to the Document will be the indexed value that is represented by the value contained
in the Issue object when the addIndex(Document, Issue, CustomFieldPrefetchedData)
method is called.
There is a strong relationship between a FieldIndexer and a ClauseQueryFactory
as the indexer creates a portion of the lucene Document and the query factory assumes it knows what this looks
like and can generate a Lucene query that will find relevant issues based on the values that were indexed.
If you are writing a CustomFieldSearcher then the glue that binds the FieldIndexer and the ClauseQueryFactory
together is the CustomFieldSearcher
since it provides both
the ClauseHandler and the FieldIndexer. Keep in mind that if you are creating one of these that the Indexer
must add fields to the document that the ClauseQueryFactory knows how to search.
Modifier and Type | Field and Description |
---|---|
static String |
LABELS_NO_VALUE_INDEX_VALUE
Empty token specific to LabelsIndexer
|
static String |
NO_VALUE_INDEX_VALUE
General empty token
|
Modifier and Type | Method and Description |
---|---|
default void |
addIndex(org.apache.lucene.document.Document doc,
Issue issue)
Deprecated.
since 8.10 use
addIndex(Document, Issue, CustomFieldPrefetchedData) instead |
default void |
addIndex(org.apache.lucene.document.Document doc,
Issue issue,
CustomFieldPrefetchedData prefetchedData)
Deprecated.
since 8.12 use
addIndex(Document, Issue, CustomFieldPrefetchedData) instead |
default void |
addIndex(org.apache.lucene.document.Document doc,
Issue issue,
CustomFieldPrefetchedData prefetchedData)
This method allows an indexer the opportunity to modify 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.
|
default Boolean |
skipsIndexingNull()
Used to declare how the indexer handles nulls.
|
static final String NO_VALUE_INDEX_VALUE
static final String LABELS_NO_VALUE_INDEX_VALUE
String getId()
String getDocumentFieldId()
Document
as a result of a successful call to the
addIndex(Document, Issue, CustomFieldPrefetchedData)
method.@Deprecated default void addIndex(org.apache.lucene.document.Document doc, Issue issue)
addIndex(Document, Issue, CustomFieldPrefetchedData)
instead
If calling isFieldVisibleAndInScope(com.atlassian.jira.issue.Issue)
returns false then
this method should create fields that have an Indexed type of org.apache.lucene.document.Field.Index#NO
.
This allows us to store the value in the index but renders 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.
Note that trying to index very large (i.e. larger than ~32 kB) fields as StringFields or DocValues will result in them being removed to prevent the indexing operation from crashing. This is a limitation of how Lucene stores terms and DocValues.
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.@Deprecated default void addIndex(org.apache.lucene.document.Document doc, Issue issue, CustomFieldPrefetchedData prefetchedData)
addIndex(Document, Issue, CustomFieldPrefetchedData)
insteaddefault void addIndex(org.apache.lucene.document.Document doc, Issue issue, CustomFieldPrefetchedData prefetchedData)
If calling isFieldVisibleAndInScope(com.atlassian.jira.issue.Issue)
returns false then
this method should create fields that have FieldType.stored()
} property set to true.
This allows us to store the value in the index but renders 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.
Note that trying to index very large (i.e. larger than ~32 kB) fields as StringFields or DocValues will result in them being removed to prevent the indexing operation from crashing. This is a limitation of how Lucene stores terms and DocValues.
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.prefetchedData
- if the custom field type implemented CustomFieldType.getNonNullCustomFieldProvider()
this reference will hold the matching value returned from NonNullCustomFieldProvider.getCustomFieldInfo(List <Issue>)
boolean isFieldVisibleAndInScope(Issue 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 org.apache.lucene.document.Field.Index#NO
.
The result of this method is used to determine the correct values that should be returned when performing an empty search.
issue
- that is having a document created from.@ExperimentalApi default Boolean skipsIndexingNull()
Copyright © 2002-2022 Atlassian. All Rights Reserved.