Class OpenSearchIssueIndexer
java.lang.Object
com.atlassian.jira.search.opensearch.OpenSearchIssueIndexer
- All Implemented Interfaces:
BackupContributor,IssueIndexer,UnmanagedIndexSearcherProvider
A search-platform agnostic implementation of
IssueIndexer, currently only used on OpenSearch mode.
This replaces the deprecated (Lucene dependent) implementation DefaultIssueIndexer- Since:
- 10.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRetrieves change histories associated with an issue to be indexedstatic interfaceRetrieves comments associated with an issue to be indexedstatic interfaceRetrieves worklogs associated with an issue to be indexedNested classes/interfaces inherited from interface com.atlassian.jira.issue.index.IssueIndexer
IssueIndexer.Analyzers -
Constructor Summary
ConstructorsConstructorDescriptionOpenSearchIssueIndexer(IndexAccessorRegistry indexAccessorRegistry, IssueFieldValuesFactory documentFactory, ChangeHistoryFieldValuesFactory changeHistoryFieldValuesFactory, CommentFieldValuesFactory commentFieldValuesFactory, WorklogFieldValuesFactory worklogFieldValuesFactory, OpenSearchIssueIndexer.ChangeHistoryRetriever changeHistoryRetriever, OpenSearchIssueIndexer.CommentRetriever commentRetriever, OpenSearchIssueIndexer.WorklogRetriever worklogRetriever, ApplicationProperties applicationProperties) -
Method Summary
Modifier and TypeMethodDescriptionconditionalUpdateWithVersion(IndexDirectoryFactory.Name indexName, org.apache.lucene.document.Document document) Index aDocumentconditionally based on the entity id and the version which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)conditionalUpdateWithVersion(org.apache.lucene.document.Document issueDocument, Collection<org.apache.lucene.document.Document> commentDocuments, Collection<org.apache.lucene.document.Document> changeHistoryDocuments, Collection<org.apache.lucene.document.Document> worklogDocuments) Index an issue document with its related documents conditionally based on the entity ids and the versions which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)voidcontributeToBackup(BackupBuilder backupBuilder) Contribute a set of files to the givenbackupBuilderto include them in the backup being created when this method was called.deindexComments(Collection<? extends WithId> comments, Context context, boolean shouldReplicate) deindexIssues(Collection<? extends WithId> issues, Context context) Delete any existing documents (in the issue index & all related entity indexes) for the Issues represented by the supplied WithIdsdeindexIssues(Collection<? extends WithId> issues, Context context, boolean shouldReplicate) Delete any existing documents (in the issue index & all related entity indexes) for the Issues represented by the supplied WithIdsdeIndexProject(Project project, boolean shouldReplicate) Remove all documents connected with given projectdeindexWorklogs(Collection<? extends WithId> worklogs, Context context, boolean shouldReplicate) voidDelete all indexes.voiddeleteIndexes(IssueIndexingParams issueIndexingParams) Delete selected indexes.protected static Stringprotected static StringgetCommentDocumentId(Comment comment) protected static StringgetIssueDocumentId(long issueId) protected static StringgetIssueDocumentId(Issue issue) Returns the document ID for an issue.intGets number of indexing threads.protected static StringgetWorklogDocumentId(Worklog worklog) indexIssues(EnclosedIterable<Issue> issues, Context context, IssueIndexingParams issueIndexingParams) Add documents for the supplied issues.indexIssuesBatchMode(IssuesBatcher batcher, Context context, IssueIndexingParams issueIndexingParams) Index all issues from the given batcher.Issue searcher has to be closed after doing stuff.optimize()reindexComments(Collection<Comment> comments, Context context, boolean shouldReplicate) Reindex a collection of issue comments.reindexCommentsInParallel(Collection<Comment> comments, Context context) Reindex a collection of issue comments on multiple threads.reindexIssues(EnclosedIterable<Issue> issues, Context context, IssueIndexingParams issueIndexingParams, boolean conditionalUpdate, boolean shouldReplicate) Re-index the given issues, delete any existing documents and add new ones.reindexIssuesBatchMode(IssuesBatcher issuesBatcher, Context context, IssueIndexingParams issueIndexingParams) Reindex issues from the given collection.reindexWorklogs(Collection<Worklog> worklogs, Context context, boolean shouldReplicate) reindexWorklogsInParallel(Collection<Worklog> worklogs, Context context) Reindex a collection of issue worklogs on multiple threads.voidshutdown()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.issue.index.IssueIndexer
deindexComments, deindexWorklogs, reindexComments, reindexWorklogs
-
Constructor Details
-
OpenSearchIssueIndexer
public OpenSearchIssueIndexer(IndexAccessorRegistry indexAccessorRegistry, IssueFieldValuesFactory documentFactory, ChangeHistoryFieldValuesFactory changeHistoryFieldValuesFactory, CommentFieldValuesFactory commentFieldValuesFactory, WorklogFieldValuesFactory worklogFieldValuesFactory, OpenSearchIssueIndexer.ChangeHistoryRetriever changeHistoryRetriever, OpenSearchIssueIndexer.CommentRetriever commentRetriever, OpenSearchIssueIndexer.WorklogRetriever worklogRetriever, ApplicationProperties applicationProperties)
-
-
Method Details
-
indexIssues
public Index.Result indexIssues(@Nonnull EnclosedIterable<Issue> issues, @Nonnull Context context, @Nonnull IssueIndexingParams issueIndexingParams) Description copied from interface:IssueIndexerAdd documents for the supplied issues.- Specified by:
indexIssuesin interfaceIssueIndexer- Parameters:
issues- An iterable of issues to index.context- for showing the user the current status.issueIndexingParams- parameters describing what should be reindexed
-
getNumberOfIndexingThreads
public int getNumberOfIndexingThreads()Description copied from interface:IssueIndexerGets number of indexing threads.Configured by 'jira.index.issue.threads'.
- Specified by:
getNumberOfIndexingThreadsin interfaceIssueIndexer- Returns:
- the number of indexing threads.
-
deindexIssues
public Index.Result deindexIssues(@Nonnull Collection<? extends WithId> issues, @Nonnull Context context) Description copied from interface:IssueIndexerDelete any existing documents (in the issue index & all related entity indexes) for the Issues represented by the supplied WithIds- Specified by:
deindexIssuesin interfaceIssueIndexer- Parameters:
issues- An iterable of WithIds for the Issues to de-index.context- for showing the user the current status.
-
deindexIssues
public Index.Result deindexIssues(@Nonnull Collection<? extends WithId> issues, @Nonnull Context context, boolean shouldReplicate) Description copied from interface:IssueIndexerDelete any existing documents (in the issue index & all related entity indexes) for the Issues represented by the supplied WithIds- Specified by:
deindexIssuesin interfaceIssueIndexer- Parameters:
issues- An iterable of WithIds for the Issues to de-index.context- for showing the user the current status.shouldReplicate- whether the index changes should be replicated to the other nodes in the cluster.
-
reindexIssuesBatchMode
public AccumulatingResultBuilder reindexIssuesBatchMode(@Nonnull IssuesBatcher issuesBatcher, @Nonnull Context context, @Nonnull IssueIndexingParams issueIndexingParams) Description copied from interface:IssueIndexerReindex issues from the given collection. As this method is not using conditional updates it must be executed under index write lock. It reindexes issues in multiple threads using the same parallelism mechanism as { @link IssueIndexer#indexIssuesBatchMode}- Specified by:
reindexIssuesBatchModein interfaceIssueIndexer- Parameters:
issuesBatcher- an iterable over issue batches.context- for showing the user the current status.issueIndexingParams- parameters describing what should be reindexed
-
reindexIssues
public Index.Result reindexIssues(@Nonnull EnclosedIterable<Issue> issues, @Nonnull Context context, @Nonnull IssueIndexingParams issueIndexingParams, boolean conditionalUpdate, boolean shouldReplicate) Description copied from interface:IssueIndexerRe-index the given issues, delete any existing documents and add new ones.- Specified by:
reindexIssuesin interfaceIssueIndexer- Parameters:
issues- An iterable of issues to index.context- for showing the user the current status.issueIndexingParams- parameters describing what should be reindexedconditionalUpdate- set to true to use conditional updates when writing to the indexshouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.
-
reindexComments
public Index.Result reindexComments(@Nonnull Collection<Comment> comments, @Nonnull Context context, boolean shouldReplicate) Description copied from interface:IssueIndexerReindex a collection of issue comments.- Specified by:
reindexCommentsin interfaceIssueIndexer- Parameters:
comments- Comments to be reindexed.context- for showing the user the current status.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.
-
reindexCommentsInParallel
public Index.Result reindexCommentsInParallel(@Nonnull Collection<Comment> comments, @Nonnull Context context) Description copied from interface:IssueIndexerReindex a collection of issue comments on multiple threads. This will not replicate the comments to the other nodes in cluster. As this method does not use conditional updates, it must be executed under index write lock.- Specified by:
reindexCommentsInParallelin interfaceIssueIndexer- Parameters:
comments- Comments to be reindexed.context- for showing the user the current status.
-
reindexWorklogsInParallel
public Index.Result reindexWorklogsInParallel(@Nonnull Collection<Worklog> worklogs, @Nonnull Context context) Description copied from interface:IssueIndexerReindex a collection of issue worklogs on multiple threads. This will not replicate the worklogs to the other nodes in cluster. As this method does not use conditional updates, it must be executed under index write lock.- Specified by:
reindexWorklogsInParallelin interfaceIssueIndexer- Parameters:
worklogs- Worklogs to be reindexed.context- for showing the user the current status.
-
reindexWorklogs
public Index.Result reindexWorklogs(@Nonnull Collection<Worklog> worklogs, @Nonnull Context context, boolean shouldReplicate) - Specified by:
reindexWorklogsin interfaceIssueIndexer
-
deindexComments
public Index.Result deindexComments(@Nonnull Collection<? extends WithId> comments, @Nonnull Context context, boolean shouldReplicate) - Specified by:
deindexCommentsin interfaceIssueIndexer
-
deindexWorklogs
public Index.Result deindexWorklogs(@Nonnull Collection<? extends WithId> worklogs, @Nonnull Context context, boolean shouldReplicate) - Specified by:
deindexWorklogsin interfaceIssueIndexer
-
conditionalUpdateWithVersion
public Index.Result conditionalUpdateWithVersion(IndexDirectoryFactory.Name indexName, org.apache.lucene.document.Document document) Description copied from interface:IssueIndexerIndex aDocumentconditionally based on the entity id and the version which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)- Specified by:
conditionalUpdateWithVersionin interfaceIssueIndexer- Parameters:
indexName- define the target indexdocument- the document needs to be indexed
-
conditionalUpdateWithVersion
public Index.Result conditionalUpdateWithVersion(org.apache.lucene.document.Document issueDocument, Collection<org.apache.lucene.document.Document> commentDocuments, Collection<org.apache.lucene.document.Document> changeHistoryDocuments, Collection<org.apache.lucene.document.Document> worklogDocuments) Description copied from interface:IssueIndexerIndex an issue document with its related documents conditionally based on the entity ids and the versions which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)- Specified by:
conditionalUpdateWithVersionin interfaceIssueIndexer- Parameters:
issueDocument- issue document needs to be indexedcommentDocuments- issue's comment documentschangeHistoryDocuments- issue's history change documentsworklogDocuments- issue's worklog documents
-
indexIssuesBatchMode
public AccumulatingResultBuilder indexIssuesBatchMode(@Nonnull IssuesBatcher batcher, @Nonnull Context context, @Nonnull IssueIndexingParams issueIndexingParams) Description copied from interface:IssueIndexerIndex all issues from the given batcher.- Specified by:
indexIssuesBatchModein interfaceIssueIndexer- Parameters:
batcher- An iterable over issue batches.context- for showing the user the current status.issueIndexingParams- parameters describing what should be reindexed
-
optimize
- Specified by:
optimizein interfaceIssueIndexer
-
deleteIndexes
public void deleteIndexes()Description copied from interface:IssueIndexerDelete all indexes.- Specified by:
deleteIndexesin interfaceIssueIndexer
-
deleteIndexes
Description copied from interface:IssueIndexerDelete selected indexes.- Specified by:
deleteIndexesin interfaceIssueIndexer- Parameters:
issueIndexingParams- parameters describing which indexes should be deleted.
-
deIndexProject
Description copied from interface:IssueIndexerRemove all documents connected with given project- Specified by:
deIndexProjectin interfaceIssueIndexer- Parameters:
project- project object
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceIssueIndexer
-
getIndexPaths
- Specified by:
getIndexPathsin interfaceIssueIndexer
-
getIndexRootPath
- Specified by:
getIndexRootPathin interfaceIssueIndexer
-
contributeToBackup
Description copied from interface:BackupContributorContribute a set of files to the givenbackupBuilderto include them in the backup being created when this method was called.- Specified by:
contributeToBackupin interfaceBackupContributor- Parameters:
backupBuilder- builder of the backup being created at the time of call. All existing and nonempty files passed to its accept method will be included. The builder may not be reusable and the reference should not be stored outside the scope of this method
-
openEntitySearcher
Description copied from interface:UnmanagedIndexSearcherProviderIssue searcher has to be closed after doing stuff. Note: when doing this you need to have the index read lock, as this may trigger creating index when not there; SeeIndexManagerBase.indexLock. SeeIndexManagerBase.getEntitySearcher(IndexDirectoryFactory.Name)()}.- Specified by:
openEntitySearcherin interfaceUnmanagedIndexSearcherProvider
-
getIssueDocumentId
Returns the document ID for an issue. This must be unique across all entities indexed by this indexer. -
getIssueDocumentId
-
getChangeHistoryDocumentId
-
getWorklogDocumentId
-
getCommentDocumentId
-