Package com.atlassian.jira.issue.index
Class IndexManagerBase
java.lang.Object
com.atlassian.jira.issue.index.IndexManagerBase
- All Implemented Interfaces:
InternalIndexingService,IssueIndexingService,IssueIndexManager,JiraIndexManager,IndexSearcherProvider,Sized,IndexLifecycleManager,Shutdown
- Direct Known Subclasses:
BulkOnlyIndexManager,DefaultIndexManager
Platform-specific base intended for the Lucene search platform only.
Jira Search exposes a common API backed by multiple search engines. This base
bypasses that abstraction and couples callers to Lucene internals.
Internal use only.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.lucene.analysis.Analyzerstatic final org.apache.lucene.analysis.Analyzer -
Constructor Summary
ConstructorsConstructorDescriptionIndexManagerBase(IndexingConfiguration indexProperties, IssueIndexer issueIndexer, IndexPathManager indexPath, ReindexMessageManager reindexMessageManager, com.atlassian.event.api.EventPublisher eventPublisher, ListenerManager listenerManager, ProjectManager projectManager, IssueManager issueManager, TaskManager taskManager, OfBizDelegator ofBizDelegator, ArchivingDao archivingDao, SearcherCache searcherCache, TimeTrackingConfiguration timeTrackingConfiguration, IndexingLanguageSetting indexingLanguageSetting, ReindexingAuditHandler reindexingAuditHandler, ArchivingLicenseCheck archivingLicenseCheck, FeatureManager featureManager, IndexConsistencyChecker indexConsistencyChecker) -
Method Summary
Modifier and TypeMethodDescriptionlongActivates search indexes.longActivates search indexes.voidconditionalUpdateWithVersion(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)voidconditionalUpdateWithVersion(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)voidDe-activates indexing (as happens from the admin page) and removes index directories.voidRemove an issue from the search index.voidDeindexing issues from a given projectvoiddeIndex(org.ofbiz.core.entity.GenericValue entity) Remove an issue from the search index.voiddeIndexComments(Set<WithId> commentsToDeIndex, boolean shouldReplicate) Remove a set of comments from the search index.voiddeIndexIssueObjectsById(Set<? extends WithId> issuesToDelete, boolean shouldReplicate) Remove a set of issues from the search index.voiddeIndexWorklogs(Set<WithId> worklogsToDeIndex, boolean shouldReplicate) Remove a set of worklogs from the search index.org.apache.lucene.analysis.AnalyzerReturns anAnalyzerfor indexing.org.apache.lucene.analysis.AnalyzerReturns anAnalyzerfor searching.Get anIndexSearcherthat can be used to search the change history index.Get anIndexSearcherthat can be used to search the comment index.Get anIndexSearcherthat can be used to search the index specified by theIndexDirectoryFactory.Name.Returns a collection of Strings, each one representing the absolute path to the actual existing directory where a plugin keeps its indexes.Get anIndexSearcherthat can be used to search the issue index.Gets the latest index date based on the most recent issue updated date.Get the root path of the index directory for plugins.Get anIndexSearcherthat can be used to search the worklog index.voidhold()Temporarily suspend indexing on this thread.booleanisEmpty()booleanisHeld()Return true if the index is held on this thread.booleanWhether this index is available.booleanlongoptimize()Optimize the underlying indexes.voidReindex an issue (eg.voidReindex an issue (eg.voidreIndex(Issue issue, IssueIndexingParams issueIndexingParams) Reindex an issue (eg.voidreIndex(org.ofbiz.core.entity.GenericValue issueGV) Reindex an issue (eg.longReindex all issues.longreIndexAll(Context context) Reindex everything.longreIndexAll(Context context, boolean useBackgroundIndexing) longreIndexAll(Context context, boolean useBackgroundIndexing, boolean notifyCluster) Reindex all issues.longreIndexAll(Context context, boolean useBackgroundIndexing, boolean reIndexComments, boolean reIndexChangeHistory, boolean notifyCluster) Reindex all issues.longreIndexAll(Context context, boolean useBackgroundIndexing, IssueIndexingParams issueIndexingParams, boolean notifyCluster) Reindex all issues.longreIndexAll(Context context, IssueIndexingParams issueIndexingParams) Reindex indexes defined by theIssueIndexingParams.longreIndexAllIssuesInBackground(Context context) Reindex everything, but don't stop the world Comments and change history will not be reindexed.longreIndexComments(Collection<Comment> comments) Reindexes a collection of comments.longreIndexComments(Collection<Comment> comments, Context context) Reindexes a collection of comments.longreIndexComments(Collection<Comment> comments, Context context, boolean shouldReplicate) Reindexes a collection of comments.voidreindexCommentsInParallel(Collection<Comment> comments, Context context) Reindexes comments on multiple threads.longreIndexIssueObjects(Collection<? extends Issue> issueObjects) Reindex a set of issues.longreIndexIssueObjects(Collection<? extends Issue> issueObjects, boolean reIndexComments, boolean reIndexChangeHistory) Reindex a set of issues.longreIndexIssueObjects(Collection<? extends Issue> issueObjects, boolean reIndexComments, boolean reIndexChangeHistory, boolean shouldReplicate) Reindex a set of issues.longreIndexIssueObjects(Collection<? extends Issue> issueObjects, IssueIndexingParams issueIndexingParams) Reindex a set of issues.longreIndexIssueObjects(Collection<? extends Issue> issueObjects, IssueIndexingParams issueIndexingParams, boolean shouldReplicate) Reindex a set of issues.longreIndexIssues(IssuesIterable issuesIterable, Context context) Reindex a list of issues, passing an optional event that will be set progresslongreIndexIssues(IssuesIterable issuesIterable, Context context, boolean reIndexComments, boolean reIndexChangeHistory) Reindex a list of issues, passing an optional event that will be set progress.longreIndexIssues(IssuesIterable issuesIterable, Context context, IssueIndexingParams issueIndexingParams) Reindex a list of issues, passing an optional event that will be set progress.longreIndexIssues(IssuesIterable issuesIterable, Context context, IssueIndexingParams issueIndexingParams, boolean shouldReplicate) Reindex a list of issues, passing an optional Context for providing status updates.longreIndexIssues(Collection<org.ofbiz.core.entity.GenericValue> issues) Reindex a set of issues (GenericValues).protected longreIndexIssues(Collection<org.ofbiz.core.entity.GenericValue> issues, IssueIndexingParams issueIndexingParams) voidreindexIssuesBatchMode(Collection<Long> issuesIdsToReindex, Context context, IssueIndexingParams params) Reindexes issues with ids provided withissuesIdsToReindex.longreIndexIssuesInBackground(Context context, IssueIndexingParams issueIndexingParams) Reindex everything, but don't stop the worldlongreIndexWorklogs(Collection<Worklog> worklogs) Reindexes a collection of worklogs.longreIndexWorklogs(Collection<Worklog> worklogs, Context context) Reindexes a collection of worklogs.longreIndexWorklogs(Collection<Worklog> worklogs, Context context, boolean shouldReplicate) Reindexes a collection of worklogs.voidreindexWorklogsInParallel(Collection<Worklog> worklogs, Context context) Reindexes worklogs on multiple threads.longrelease()Release indexing on this thread.voidshutdown()Shuts down the indexing manager and closes its resources (if any).intsize()toString()voidunconditionallyReindexIssuesAndRelatedEntitiesLocally(Collection<Issue> issueObjects) Unconditionally updates issues and all related entities indexes: comments, worklogs and changeHistory.booleanwithReindexLock(Runnable runnable) This method takes a runnable that is run under the 'stop the world' reindex lock.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.atlassian.jira.issue.index.IssueIndexingService
deIndex, deIndexIssueObjectsMethods inherited from interface com.atlassian.jira.issue.index.JiraIndexManager
get
-
Field Details
-
ANALYZER_FOR_SEARCHING
public static final org.apache.lucene.analysis.Analyzer ANALYZER_FOR_SEARCHING -
ANALYZER_FOR_INDEXING
public static final org.apache.lucene.analysis.Analyzer ANALYZER_FOR_INDEXING
-
-
Constructor Details
-
IndexManagerBase
public IndexManagerBase(IndexingConfiguration indexProperties, IssueIndexer issueIndexer, IndexPathManager indexPath, ReindexMessageManager reindexMessageManager, com.atlassian.event.api.EventPublisher eventPublisher, ListenerManager listenerManager, ProjectManager projectManager, IssueManager issueManager, TaskManager taskManager, OfBizDelegator ofBizDelegator, ArchivingDao archivingDao, SearcherCache searcherCache, TimeTrackingConfiguration timeTrackingConfiguration, IndexingLanguageSetting indexingLanguageSetting, ReindexingAuditHandler reindexingAuditHandler, ArchivingLicenseCheck archivingLicenseCheck, FeatureManager featureManager, IndexConsistencyChecker indexConsistencyChecker)
-
-
Method Details
-
getAnalyzerForSearching
public org.apache.lucene.analysis.Analyzer getAnalyzerForSearching()Description copied from interface:IssueIndexManagerReturns anAnalyzerfor searching.- Specified by:
getAnalyzerForSearchingin interfaceIssueIndexManager- Returns:
- an analyzer for searching
-
getAnalyzerForIndexing
public org.apache.lucene.analysis.Analyzer getAnalyzerForIndexing()Description copied from interface:IssueIndexManagerReturns anAnalyzerfor indexing.- Specified by:
getAnalyzerForIndexingin interfaceIssueIndexManager- Returns:
- an analyzer for indexing.
-
deactivate
public void deactivate()Description copied from interface:IndexLifecycleManagerDe-activates indexing (as happens from the admin page) and removes index directories.- Specified by:
deactivatein interfaceIndexLifecycleManager
-
activate
Description copied from interface:IndexLifecycleManagerActivates search indexes. This will rebuild the indexes.- Specified by:
activatein interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms
-
activate
Description copied from interface:IndexLifecycleManagerActivates search indexes.- Specified by:
activatein interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.reindex- reindex after activation.- Returns:
- Reindex time in ms
-
isIndexAvailable
public boolean isIndexAvailable()Description copied from interface:IndexLifecycleManagerWhether this index is available. The index is not available if the index is being rebuilt or recovered. In a clustered environment this reflects only the state on the local node.- Specified by:
isIndexAvailablein interfaceIndexLifecycleManager- Returns:
- Whether this index is available.
-
reIndexAll
Description copied from interface:IssueIndexManagerReindex all issues.- Specified by:
reIndexAllin interfaceIssueIndexingService- Specified by:
reIndexAllin interfaceIssueIndexManager- Returns:
- The number of milliseconds taken to reindex everything, or -1 if not indexing
- Throws:
IndexException
-
reIndexAll
Description copied from interface:IndexLifecycleManagerReindex everything.- Specified by:
reIndexAllin interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms.
-
reIndexAll
-
reIndexAll
Description copied from interface:IssueIndexManagerReindex all issues.- Specified by:
reIndexAllin interfaceIssueIndexingService- Specified by:
reIndexAllin interfaceIssueIndexManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be nulluseBackgroundIndexing- whether to index in the background or not. If the useBackgroundReindexing option is set to true, then all related fields will not be reindexed.notifyCluster- whether or not to notify the cluster about reindexing all- Returns:
- Reindex time in ms.
-
reIndexAll
public long reIndexAll(Context context, boolean useBackgroundIndexing, boolean reIndexComments, boolean reIndexChangeHistory, boolean notifyCluster) Description copied from interface:IssueIndexManagerReindex all issues. If the useBackgroundReindexing option is set to true, then only the basic issue information will be reindexed, unless the reIndexComments or reIndexChangeHistory parameters are also set. This is considered the normal mode for background re-indexing and is sufficient to correct the index for changes in the system configuration, but not for changes to the indexing language. If useBackgroundReindexing is set to false, than everything is always reindexed.- Specified by:
reIndexAllin interfaceIssueIndexManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be nulluseBackgroundIndexing- whether to index in the background or notreIndexComments- Also reindex all the issue comments. Only relevant for background reindex operations.reIndexChangeHistory- Also reindex the issue change history. Only relevant for background reindex operations.notifyCluster- whether or not to notify the cluster about reindexing all- Returns:
- Reindex time in ms.
-
reIndexAll
Description copied from interface:IndexLifecycleManagerReindex indexes defined by theIssueIndexingParams.- Specified by:
reIndexAllin interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.issueIndexingParams- indexes to reindex.- Returns:
- Reindex time in ms.
-
reIndexAll
public long reIndexAll(Context context, boolean useBackgroundIndexing, IssueIndexingParams issueIndexingParams, boolean notifyCluster) Description copied from interface:IssueIndexManagerReindex all issues. If the useBackgroundReindexing option is set to true, then only the basic issue information will be reindexed, unless the indexing parameters are also set. This is considered the normal mode for background re-indexing and is sufficient to correct the index for changes in the system configuration, but not for changes to the indexing language. If useBackgroundReindexing is set to false, than everything is always reindexed.- Specified by:
reIndexAllin interfaceIssueIndexingService- Specified by:
reIndexAllin interfaceIssueIndexManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be nulluseBackgroundIndexing- whether to index in the background or notissueIndexingParams- determines witch related objects should be indexed together with issues. Only relevant for background reindex operations.notifyCluster- whether or not to notify the cluster about reindexing all- Returns:
- Reindex time in ms.
-
withReindexLock
This method takes a runnable that is run under the 'stop the world' reindex lock. It is used here in preference to a Guava function in order to avoid introducing more Guava into the API, which limits our ability to update the library. The runnable is executed in the current thread.- Specified by:
withReindexLockin interfaceIssueIndexManager- Parameters:
runnable- The runnable to be executed- Returns:
- true if the lock was acquired and the runnable was run, false if the lock could not be acquired and the code was not run
-
reIndexAllIssuesInBackground
Description copied from interface:IndexLifecycleManagerReindex everything, but don't stop the world Comments and change history will not be reindexed.- Specified by:
reIndexAllIssuesInBackgroundin interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms.
-
reIndexIssuesInBackground
Description copied from interface:IndexLifecycleManagerReindex everything, but don't stop the world- Specified by:
reIndexIssuesInBackgroundin interfaceIndexLifecycleManager- Parameters:
context- used to report progress back to the user or to the logs. Must not be null.issueIndexingParams- determines witch related objects should be indexed together with issue.- Returns:
- Reindex time in ms.
-
reIndexIssues
public long reIndexIssues(Collection<org.ofbiz.core.entity.GenericValue> issues) throws IndexException Description copied from interface:IssueIndexManagerReindex a set of issues (GenericValues). UseIssueIndexManager.reIndexIssueObjects(Collection)instead when possible.- Specified by:
reIndexIssuesin interfaceIssueIndexManager- Parameters:
issues- The IssueGenericValues to reindex.- Returns:
- Reindex time in ms.
- Throws:
IndexException
-
reIndexIssues
protected long reIndexIssues(Collection<org.ofbiz.core.entity.GenericValue> issues, IssueIndexingParams issueIndexingParams) throws IndexException - Throws:
IndexException
-
reIndexIssueObjects
Description copied from interface:IssueIndexManagerReindex a set of issues.- Specified by:
reIndexIssueObjectsin interfaceIssueIndexingService- Specified by:
reIndexIssueObjectsin interfaceIssueIndexManager- Parameters:
issueObjects- Set ofIssues to reindex.- Returns:
- Reindex time in ms.
- Throws:
IndexException
-
reIndexIssueObjects
public long reIndexIssueObjects(Collection<? extends Issue> issueObjects, boolean reIndexComments, boolean reIndexChangeHistory) throws IndexException Description copied from interface:IssueIndexManagerReindex a set of issues.- Specified by:
reIndexIssueObjectsin interfaceIssueIndexManager- Parameters:
issueObjects- Set ofIssues to reindex.- Returns:
- Reindex time in ms.
- Throws:
IndexException
-
reIndexIssueObjects
public long reIndexIssueObjects(Collection<? extends Issue> issueObjects, IssueIndexingParams issueIndexingParams) throws IndexException Description copied from interface:IssueIndexManagerReindex a set of issues.- Specified by:
reIndexIssueObjectsin interfaceIssueIndexingService- Specified by:
reIndexIssueObjectsin interfaceIssueIndexManager- Parameters:
issueObjects- Set ofIssues to reindex.issueIndexingParams- Determines witch related objects should be indexed together with issues.- Returns:
- Reindex time in ms.
- Throws:
IndexException
-
reIndexIssueObjects
public long reIndexIssueObjects(Collection<? extends Issue> issueObjects, boolean reIndexComments, boolean reIndexChangeHistory, boolean shouldReplicate) Description copied from interface:IssueIndexManagerReindex a set of issues.- Specified by:
reIndexIssueObjectsin interfaceIssueIndexManager- Parameters:
issueObjects- Set ofIssues to reindex.reIndexComments- whether to reindex the comments or notreIndexChangeHistory- whether to reindex changeHistory or notshouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.- Returns:
- Reindex time in ms.
-
reIndexIssueObjects
public long reIndexIssueObjects(Collection<? extends Issue> issueObjects, IssueIndexingParams issueIndexingParams, boolean shouldReplicate) Description copied from interface:IssueIndexManagerReindex a set of issues.- Specified by:
reIndexIssueObjectsin interfaceIssueIndexingService- Specified by:
reIndexIssueObjectsin interfaceIssueIndexManager- Parameters:
issueObjects- Set ofIssues to reindex.issueIndexingParams- Determines witch related objects should be indexed together with issues.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.- Returns:
- Reindex time in ms.
-
deIndex
Description copied from interface:IssueIndexingServiceDeindexing issues from a given project- Specified by:
deIndexin interfaceIssueIndexingService- Parameters:
project- project objectshouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.
-
deIndexComments
Description copied from interface:IssueIndexingServiceRemove a set of comments from the search index.- Specified by:
deIndexCommentsin interfaceIssueIndexingService- Parameters:
commentsToDeIndex- set ofWithIds to deIndex.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.
-
deIndexWorklogs
Description copied from interface:IssueIndexingServiceRemove a set of worklogs from the search index.- Specified by:
deIndexWorklogsin interfaceIssueIndexingService- Parameters:
worklogsToDeIndex- set ofWithIds to deIndex.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.
-
reIndex
Description copied from interface:IssueIndexManagerReindex an issue (eg. after field updates).- Specified by:
reIndexin interfaceIssueIndexingService- Specified by:
reIndexin interfaceIssueIndexManager- Throws:
IndexException
-
reIndex
Description copied from interface:IssueIndexManagerReindex an issue (eg. after field updates).- Specified by:
reIndexin interfaceIssueIndexManager
-
reIndex
Description copied from interface:IssueIndexManagerReindex an issue (eg. after field updates).- Specified by:
reIndexin interfaceIssueIndexingService- Specified by:
reIndexin interfaceIssueIndexManager
-
reIndex
Description copied from interface:IssueIndexManagerReindex an issue (eg. after field updates).- Specified by:
reIndexin interfaceIssueIndexManager- Throws:
IndexException
-
hold
public void hold()Description copied from interface:IssueIndexManagerTemporarily suspend indexing on this thread. All index requests will be queued and processed when release is called.- Specified by:
holdin interfaceIssueIndexingService- Specified by:
holdin interfaceIssueIndexManager
-
isHeld
public boolean isHeld()Description copied from interface:IssueIndexManagerReturn true if the index is held on this thread.- Specified by:
isHeldin interfaceIssueIndexingService- Specified by:
isHeldin interfaceIssueIndexManager
-
release
Description copied from interface:IssueIndexManagerRelease indexing on this thread. All queued index requests will be processed.- Specified by:
releasein interfaceIssueIndexingService- Specified by:
releasein interfaceIssueIndexManager- Returns:
- Reindex time in ms.
- Throws:
IndexException- if an error occurs
-
reIndexIssues
Description copied from interface:IssueIndexManagerReindex a list of issues, passing an optional event that will be set progress- Specified by:
reIndexIssuesin interfaceIssueIndexingService- Specified by:
reIndexIssuesin interfaceIssueIndexManager- Parameters:
issuesIterable- IssuesIterablecontext- used to report progress back to the user or to the logs. Must not be null.- Returns:
- Reindex time in ms.
- Throws:
IndexException
-
reIndexIssues
public long reIndexIssues(IssuesIterable issuesIterable, Context context, boolean reIndexComments, boolean reIndexChangeHistory) throws IndexException Description copied from interface:IssueIndexManagerReindex a list of issues, passing an optional event that will be set progress. This method can optionally also index the comments and change history.- Specified by:
reIndexIssuesin interfaceIssueIndexManager- Parameters:
issuesIterable- IssuesIterablecontext- used to report progress back to the user or to the logs. Must not be null.reIndexComments- a boolean indicating whether to index issue commentsreIndexChangeHistory- a boolean indicating whether to index issue change history- Returns:
- Reindex time in ms.
- Throws:
IndexException
-
reIndexIssues
public long reIndexIssues(IssuesIterable issuesIterable, Context context, IssueIndexingParams issueIndexingParams) Description copied from interface:IssueIndexManagerReindex a list of issues, passing an optional event that will be set progress. This method can optionally also index the comments and change history.- Specified by:
reIndexIssuesin interfaceIssueIndexingService- Specified by:
reIndexIssuesin interfaceIssueIndexManager- Parameters:
issuesIterable- IssuesIterablecontext- used to report progress back to the user or to the logs. Must not be null.issueIndexingParams- determines witch related objects should be indexed together with issue.- Returns:
- Reindex time in ms.
-
reIndexIssues
public long reIndexIssues(IssuesIterable issuesIterable, Context context, IssueIndexingParams issueIndexingParams, boolean shouldReplicate) Description copied from interface:IssueIndexingServiceReindex a list of issues, passing an optional Context for providing status updates. This method can optionally also index the comments and change history. It also allows the caller to specify whether or not the indexing changes should be replicated to the rest of the cluster.- Specified by:
reIndexIssuesin interfaceIssueIndexingService- Parameters:
issuesIterable- IssuesIterable of issues to reindexcontext- used to report progress back to the user or to the logs. Must not be null.issueIndexingParams- determines witch related objects should be indexed together with issue.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.- Returns:
- Reindex time in ms, -1 if there's an error.
-
reIndexComments
Description copied from interface:IssueIndexManagerReindexes a collection of comments.- Specified by:
reIndexCommentsin interfaceIssueIndexingService- Specified by:
reIndexCommentsin interfaceIssueIndexManager- Parameters:
comments- a collection of Comment- Throws:
IndexException
-
reIndexComments
Description copied from interface:IssueIndexManagerReindexes a collection of comments.- Specified by:
reIndexCommentsin interfaceIssueIndexingService- Specified by:
reIndexCommentsin interfaceIssueIndexManager- Parameters:
comments- a collection of Commentcontext- used to report progress back to the user or to the logs. Must not be null.- Throws:
IndexException
-
reIndexComments
public long reIndexComments(Collection<Comment> comments, Context context, boolean shouldReplicate) throws IndexException Description copied from interface:IssueIndexManagerReindexes a collection of comments.- Specified by:
reIndexCommentsin interfaceIssueIndexingService- Specified by:
reIndexCommentsin interfaceIssueIndexManager- Parameters:
comments- a collection of Commentcontext- used to report progress back to the user or to the logs. Must not be null.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.- Throws:
IndexException
-
reIndexWorklogs
Description copied from interface:IssueIndexManagerReindexes a collection of worklogs.- Specified by:
reIndexWorklogsin interfaceIssueIndexingService- Specified by:
reIndexWorklogsin interfaceIssueIndexManager- Parameters:
worklogs- a collection of Worklogs- Throws:
IndexException
-
reIndexWorklogs
Description copied from interface:IssueIndexManagerReindexes a collection of worklogs.- Specified by:
reIndexWorklogsin interfaceIssueIndexingService- Specified by:
reIndexWorklogsin interfaceIssueIndexManager- Parameters:
worklogs- a collection of Worklogscontext- used to report progress back to the user or to the logs. Must not be null.- Throws:
IndexException
-
reIndexWorklogs
public long reIndexWorklogs(Collection<Worklog> worklogs, Context context, boolean shouldReplicate) throws IndexException Description copied from interface:IssueIndexManagerReindexes a collection of worklogs.- Specified by:
reIndexWorklogsin interfaceIssueIndexingService- Specified by:
reIndexWorklogsin interfaceIssueIndexManager- Parameters:
worklogs- a collection of Worklogscontext- used to report progress back to the user or to the logs. Must not be null.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.- Throws:
IndexException
-
isIndexConsistent
public boolean isIndexConsistent()- Specified by:
isIndexConsistentin interfaceIndexLifecycleManager- Returns:
- the result of a simple consistency check that compares the index state to
the current number of issues in the database. A background re-index should not be attempted
when this returns
false. Note thatfalseis also returned if the index is not available .
-
getLatestIndexDate
Description copied from interface:IssueIndexManagerGets the latest index date based on the most recent issue updated date.- Specified by:
getLatestIndexDatein interfaceIssueIndexingService- Specified by:
getLatestIndexDatein interfaceIssueIndexManager- Returns:
- latest index update date or null if no issues in index or no updated value in issues
-
size
public int size()- Specified by:
sizein interfaceIndexLifecycleManager- Specified by:
sizein interfaceSized- Returns:
- how many Entities will be re-indexed by
IndexLifecycleManager.reIndexAll(Context)
-
isEmpty
public boolean isEmpty() -
optimize
public long optimize()Description copied from interface:IndexLifecycleManagerOptimize the underlying indexes. Make the subsequent searching more efficient.- Specified by:
optimizein interfaceIndexLifecycleManager- Returns:
- the amount of time in millis this method took (because you are too lazy to time me), 0 if indexing is not enabled or -1 if we cannot obtain the index writeLock.
-
deIndex
Description copied from interface:IssueIndexingServiceRemove an issue from the search index.- Specified by:
deIndexin interfaceIssueIndexingService- Throws:
IndexException
-
deIndexIssueObjectsById
Description copied from interface:IssueIndexingServiceRemove a set of issues from the search index.- Specified by:
deIndexIssueObjectsByIdin interfaceIssueIndexingService- Parameters:
issuesToDelete- set ofWithIds to deIndex.shouldReplicate- whether or not the index changes should be replicated to the other nodes in the cluster.
-
deIndex
Description copied from interface:IssueIndexManagerRemove an issue from the search index.- Specified by:
deIndexin interfaceIssueIndexManager- Throws:
IndexException
-
conditionalUpdateWithVersion
public void conditionalUpdateWithVersion(IndexDirectoryFactory.Name indexName, org.apache.lucene.document.Document document) Description copied from interface:InternalIndexingServiceIndex aDocumentconditionally based on the entity id and the version which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)- Specified by:
conditionalUpdateWithVersionin interfaceInternalIndexingService- Parameters:
indexName- define the target indexdocument- the document needs to be indexed
-
conditionalUpdateWithVersion
public void 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:InternalIndexingServiceIndex 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 interfaceInternalIndexingService- Parameters:
issueDocument- issue document needs to be indexedcommentDocuments- issue's comment documentschangeHistoryDocuments- issue's history change documentsworklogDocuments- issue's worklog documents
-
unconditionallyReindexIssuesAndRelatedEntitiesLocally
Description copied from interface:InternalIndexingServiceUnconditionally updates issues and all related entities indexes: comments, worklogs and changeHistory. For related entities, the existing collection will be fully replaced by the new collection of related entities. Note that this may leave the index in a stale state when there are any other indexing tasks running in parallel. This operation should be followed by a conditional re-index to fix the possibly stale data. This operation may be needed to delete related entities from index by re-indexing an issue. Note that in a cluster this affects only the local index, i.e. this operation will not be replicated to other nodes. To be removed in Jira 9.0. (DBR-242)- Specified by:
unconditionallyReindexIssuesAndRelatedEntitiesLocallyin interfaceInternalIndexingService- Parameters:
issueObjects- issues need to be re-indexed unconditionally locally
-
getPluginsRootPath
Description copied from interface:IssueIndexManagerGet the root path of the index directory for plugins. Any plugin that keeps indexes should create its own sub-directory under this path and create its indexes in its own sub-directory- Specified by:
getPluginsRootPathin interfaceIssueIndexManager
-
getExistingPluginsPaths
Description copied from interface:IssueIndexManagerReturns a collection of Strings, each one representing the absolute path to the actual existing directory where a plugin keeps its indexes. Each directory in the collection should be a sub-directory under the plugin's index root path. SeeIssueIndexManager.getPluginsRootPath().If a plugin index root path does not exist, or is empty (no sub-directopries exist) then an empty collection will be returned.
- Specified by:
getExistingPluginsPathsin interfaceIssueIndexManager
-
getIssueSearcher
Description copied from interface:IssueIndexManagerGet anIndexSearcherthat can be used to search the issue index. This is specific to Lucene search platform, useIndexAccessorRegistryto get a platform-agnosticIndexSearcherinstead.- Specified by:
getIssueSearcherin interfaceIssueIndexManager
-
getCommentSearcher
Description copied from interface:IssueIndexManagerGet anIndexSearcherthat can be used to search the comment index. This is specific to Lucene search platform, useIndexAccessorRegistryto get a platform-agnosticIndexSearcherinstead.- Specified by:
getCommentSearcherin interfaceIssueIndexManager
-
getChangeHistorySearcher
Description copied from interface:IssueIndexManagerGet anIndexSearcherthat can be used to search the change history index. This is specific to Lucene search platform, useIndexAccessorRegistryto get a platform-agnosticIndexSearcherinstead.- Specified by:
getChangeHistorySearcherin interfaceIssueIndexManager
-
getWorklogSearcher
Description copied from interface:IssueIndexManagerGet anIndexSearcherthat can be used to search the worklog index. This is specific to Lucene search platform, useIndexAccessorRegistryto get a platform-agnosticIndexSearcherinstead.- Specified by:
getWorklogSearcherin interfaceIssueIndexManager
-
getEntitySearcher
Description copied from interface:InternalIndexingServiceGet anIndexSearcherthat can be used to search the index specified by theIndexDirectoryFactory.Name. This is specific to Lucene search platform, useIndexAccessorRegistryto get a platform-agnosticIndexSearcherinstead.- Specified by:
getEntitySearcherin interfaceInternalIndexingService- Parameters:
index- Index for which a searcher should be returned
-
reindexIssuesBatchMode
public void reindexIssuesBatchMode(Collection<Long> issuesIdsToReindex, Context context, IssueIndexingParams params) throws IndexException Description copied from interface:InternalIndexingServiceReindexes issues with ids provided withissuesIdsToReindex. Like foreground reindex will perform the reindex operations under index write lock and on multiple threads. The lock is needed because of 2 reasons: - the updates are not conditional (so we could overwrite newer concurrent update) - multithreading could saturate the indexer.- Specified by:
reindexIssuesBatchModein interfaceInternalIndexingService- Parameters:
issuesIdsToReindex- ids specifying which issues to reindex.context- used to report progress back to the user or to the logs.params- determines witch related objects should be indexed together with issues.- Throws:
IndexException- in case the lock couldn't be acquired.
-
reindexCommentsInParallel
public void reindexCommentsInParallel(Collection<Comment> comments, Context context) throws IndexException Description copied from interface:InternalIndexingServiceReindexes comments on multiple threads. Performs the operation under index write lock The lock is needed because of 2 reasons: - the updates are not conditional (so we could overwrite newer concurrent update) - multithreading could saturate the indexer.- Specified by:
reindexCommentsInParallelin interfaceInternalIndexingService- Parameters:
comments- comments to reindexcontext- used to report progress back to the user or to the logs.- Throws:
IndexException- in case the lock couldn't be acquired.
-
reindexWorklogsInParallel
public void reindexWorklogsInParallel(Collection<Worklog> worklogs, Context context) throws IndexException Description copied from interface:InternalIndexingServiceReindexes worklogs on multiple threads. Performs the operation under index write lock The lock is needed because of 2 reasons: - the updates are not conditional (so we could overwrite newer concurrent update) - multithreading could saturate the indexer.- Specified by:
reindexWorklogsInParallelin interfaceInternalIndexingService- Parameters:
worklogs- worklogs to reindexcontext- used to report progress back to the user or to the logs.- Throws:
IndexException- in case the lock couldn't be acquired.
-
getAllIndexPaths
- Specified by:
getAllIndexPathsin interfaceIndexLifecycleManager- Returns:
- a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.
It's Lucene specific, no longer relevant for OpenSearch. No replacement.
Platform-specific method intended for the Lucene search platform only.
Jira Search exposes a common API backed by multiple search engines. This method bypasses that abstraction and couples callers to Lucene internals.
Using this method in platform-agnostic code, or when the runtime search platform is not Lucene (e.g. OpenSearch), may produce incorrect results or failures. Internal use only.
-
shutdown
public void shutdown()Description copied from interface:IndexLifecycleManagerShuts down the indexing manager and closes its resources (if any).- Specified by:
shutdownin interfaceIndexLifecycleManager- Specified by:
shutdownin interfaceShutdown
-
toString
-