Package com.atlassian.jira.issue.index
Class DefaultIndexManager
java.lang.Object
com.atlassian.jira.issue.index.DefaultIndexManager
- All Implemented Interfaces:
InternalIndexingService
,IssueIndexingService
,IssueIndexManager
,Sized
,IndexLifecycleManager
,Shutdown
- Direct Known Subclasses:
BulkOnlyIndexManager
public class DefaultIndexManager
extends Object
implements IssueIndexManager, InternalIndexingService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.lucene.analysis.Analyzer
static final org.apache.lucene.analysis.Analyzer
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultIndexManager
(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) -
Method Summary
Modifier and TypeMethodDescriptionlong
Activates search indexes.long
Activates search indexes.void
conditionalUpdateWithVersion
(IndexDirectoryFactory.Name indexName, org.apache.lucene.document.Document document) Index aDocument
conditionally based on the entity id and the version which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)
andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)
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) 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)
void
De-activates indexing (as happens from the admin page) and removes index directories.void
Remove an issue from the search index.void
Deindexing issues from a given projectvoid
deIndex
(org.ofbiz.core.entity.GenericValue entity) Remove an issue from the search index.void
deIndexComments
(Set<WithId> commentsToDeIndex, boolean shouldReplicate) Remove a set of comments from the search index.void
deIndexIssueObjectsById
(Set<? extends WithId> issuesToDelete, boolean shouldReplicate) Remove a set of issues from the search index.void
deIndexWorklogs
(Set<WithId> worklogsToDeIndex, boolean shouldReplicate) Remove a set of worklogs from the search index.org.apache.lucene.analysis.Analyzer
Returns anAnalyzer
for indexing.org.apache.lucene.analysis.Analyzer
Returns anAnalyzer
for searching.Get anIndexSearcher
that can be used to search the change history index.Get anIndexSearcher
that can be used to search the comment index.Get anIndexSearcher
that 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 anIndexSearcher
that 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 anIndexSearcher
that can be used to search the worklog index.void
hold()
Temporarily suspend indexing on this thread.boolean
isEmpty()
boolean
isHeld()
Return true if the index is held.boolean
Whether this index is available.boolean
long
optimize()
Optimize the underlying indexes.void
Reindex an issue (eg.void
Reindex an issue (eg.void
reIndex
(Issue issue, IssueIndexingParams issueIndexingParams) Reindex an issue (eg.void
reIndex
(org.ofbiz.core.entity.GenericValue issueGV) Reindex an issue (eg.long
Reindex all issues.long
reIndexAll
(Context context) Reindex everything.long
reIndexAll
(Context context, boolean useBackgroundIndexing) long
reIndexAll
(Context context, boolean useBackgroundIndexing, boolean notifyCluster) Reindex all issues.long
reIndexAll
(Context context, boolean useBackgroundIndexing, boolean reIndexComments, boolean reIndexChangeHistory, boolean notifyCluster) Reindex all issues.long
reIndexAll
(Context context, boolean useBackgroundIndexing, IssueIndexingParams issueIndexingParams, boolean notifyCluster) Reindex all issues.long
reIndexAll
(Context context, IssueIndexingParams issueIndexingParams) Reindex indexes defined by theIssueIndexingParams
.long
reIndexAllIssuesInBackground
(Context context) Reindex everything, but don't stop the world Comments and change history will not be reindexed.long
reIndexComments
(Collection<Comment> comments) Reindexes a collection of comments.long
reIndexComments
(Collection<Comment> comments, Context context) Reindexes a collection of comments.long
reIndexComments
(Collection<Comment> comments, Context context, boolean shouldReplicate) Reindexes a collection of comments.void
reindexCommentsInParallel
(Collection<Comment> comments, Context context) Reindexes comments on multiple threads.long
reIndexIssueObjects
(Collection<? extends Issue> issueObjects) Reindex a set of issues.long
reIndexIssueObjects
(Collection<? extends Issue> issueObjects, boolean reIndexComments, boolean reIndexChangeHistory) Reindex a set of issues.long
reIndexIssueObjects
(Collection<? extends Issue> issueObjects, boolean reIndexComments, boolean reIndexChangeHistory, boolean shouldReplicate) Reindex a set of issues.long
reIndexIssueObjects
(Collection<? extends Issue> issueObjects, IssueIndexingParams issueIndexingParams) Reindex a set of issues.long
reIndexIssueObjects
(Collection<? extends Issue> issueObjects, IssueIndexingParams issueIndexingParams, boolean shouldReplicate) Reindex a set of issues.long
reIndexIssues
(IssuesIterable issuesIterable, Context context) Reindex a list of issues, passing an optional event that will be set progresslong
reIndexIssues
(IssuesIterable issuesIterable, Context context, boolean reIndexComments, boolean reIndexChangeHistory) Reindex a list of issues, passing an optional event that will be set progress.long
reIndexIssues
(IssuesIterable issuesIterable, Context context, IssueIndexingParams issueIndexingParams) Reindex a list of issues, passing an optional event that will be set progress.long
reIndexIssues
(IssuesIterable issuesIterable, Context context, IssueIndexingParams issueIndexingParams, boolean shouldReplicate) Reindex a list of issues, passing an optional Context for providing status updates.long
reIndexIssues
(Collection<org.ofbiz.core.entity.GenericValue> issues) Reindex a set of issues (GenericValues).protected long
reIndexIssues
(Collection<org.ofbiz.core.entity.GenericValue> issues, IssueIndexingParams issueIndexingParams) void
reindexIssuesBatchMode
(Collection<Long> issuesIdsToReindex, Context context, IssueIndexingParams params) Reindexes issues with ids provided withissuesIdsToReindex
.long
reIndexIssuesInBackground
(Context context, IssueIndexingParams issueIndexingParams) Reindex everything, but don't stop the worldlong
reIndexWorklogs
(Collection<Worklog> worklogs) Reindexes a collection of worklogs.long
reIndexWorklogs
(Collection<Worklog> worklogs, Context context) Reindexes a collection of worklogs.long
reIndexWorklogs
(Collection<Worklog> worklogs, Context context, boolean shouldReplicate) Reindexes a collection of worklogs.void
reindexWorklogsInParallel
(Collection<Worklog> worklogs, Context context) Reindexes worklogs on multiple threads.long
release()
Release indexing on this thread.void
shutdown()
Shuts down the indexing manager and closes its resources (if any).int
size()
toString()
void
unconditionallyReindexIssuesAndRelatedEntitiesLocally
(Collection<Issue> issueObjects) Unconditionally updates issues and all related entities indexes: comments, worklogs and changeHistory.boolean
withReindexLock
(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, wait
Methods inherited from interface com.atlassian.jira.issue.index.IssueIndexingService
deIndex, deIndexIssueObjects
-
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
-
DefaultIndexManager
public DefaultIndexManager(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)
-
-
Method Details
-
getAnalyzerForSearching
public org.apache.lucene.analysis.Analyzer getAnalyzerForSearching()Description copied from interface:IssueIndexManager
Returns anAnalyzer
for searching.- Specified by:
getAnalyzerForSearching
in interfaceIssueIndexManager
- Returns:
- an analyzer for searching
-
getAnalyzerForIndexing
public org.apache.lucene.analysis.Analyzer getAnalyzerForIndexing()Description copied from interface:IssueIndexManager
Returns anAnalyzer
for indexing.- Specified by:
getAnalyzerForIndexing
in interfaceIssueIndexManager
- Returns:
- an analyzer for indexing.
-
deactivate
public void deactivate()Description copied from interface:IndexLifecycleManager
De-activates indexing (as happens from the admin page) and removes index directories.- Specified by:
deactivate
in interfaceIndexLifecycleManager
-
activate
Description copied from interface:IndexLifecycleManager
Activates search indexes. This will rebuild the indexes.- Specified by:
activate
in 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:IndexLifecycleManager
Activates search indexes.- Specified by:
activate
in 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:IndexLifecycleManager
Whether 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:
isIndexAvailable
in interfaceIndexLifecycleManager
- Returns:
- Whether this index is available.
-
reIndexAll
Description copied from interface:IssueIndexManager
Reindex all issues.- Specified by:
reIndexAll
in interfaceIssueIndexingService
- Specified by:
reIndexAll
in interfaceIssueIndexManager
- Returns:
- The number of milliseconds taken to reindex everything, or -1 if not indexing
- Throws:
IndexException
-
reIndexAll
Description copied from interface:IndexLifecycleManager
Reindex everything.- Specified by:
reIndexAll
in 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:IssueIndexManager
Reindex all issues.- Specified by:
reIndexAll
in interfaceIssueIndexingService
- Specified by:
reIndexAll
in 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:IssueIndexManager
Reindex 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:
reIndexAll
in 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:IndexLifecycleManager
Reindex indexes defined by theIssueIndexingParams
.- Specified by:
reIndexAll
in 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:IssueIndexManager
Reindex 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:
reIndexAll
in interfaceIssueIndexingService
- Specified by:
reIndexAll
in 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:
withReindexLock
in 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:IndexLifecycleManager
Reindex everything, but don't stop the world Comments and change history will not be reindexed.- Specified by:
reIndexAllIssuesInBackground
in 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:IndexLifecycleManager
Reindex everything, but don't stop the world- Specified by:
reIndexIssuesInBackground
in 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:IssueIndexManager
Reindex a set of issues (GenericValues). UseIssueIndexManager.reIndexIssueObjects(Collection)
instead when possible.- Specified by:
reIndexIssues
in interfaceIssueIndexManager
- Parameters:
issues
- The IssueGenericValue
s 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:IssueIndexManager
Reindex a set of issues.- Specified by:
reIndexIssueObjects
in interfaceIssueIndexingService
- Specified by:
reIndexIssueObjects
in interfaceIssueIndexManager
- Parameters:
issueObjects
- Set ofIssue
s 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:IssueIndexManager
Reindex a set of issues.- Specified by:
reIndexIssueObjects
in interfaceIssueIndexManager
- Parameters:
issueObjects
- Set ofIssue
s 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:IssueIndexManager
Reindex a set of issues.- Specified by:
reIndexIssueObjects
in interfaceIssueIndexingService
- Specified by:
reIndexIssueObjects
in interfaceIssueIndexManager
- Parameters:
issueObjects
- Set ofIssue
s 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:IssueIndexManager
Reindex a set of issues.- Specified by:
reIndexIssueObjects
in interfaceIssueIndexManager
- Parameters:
issueObjects
- Set ofIssue
s 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:IssueIndexManager
Reindex a set of issues.- Specified by:
reIndexIssueObjects
in interfaceIssueIndexingService
- Specified by:
reIndexIssueObjects
in interfaceIssueIndexManager
- Parameters:
issueObjects
- Set ofIssue
s 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:IssueIndexingService
Deindexing issues from a given project- Specified by:
deIndex
in 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:IssueIndexingService
Remove a set of comments from the search index.- Specified by:
deIndexComments
in interfaceIssueIndexingService
- Parameters:
commentsToDeIndex
- set ofWithId
s to deIndex.shouldReplicate
- whether or not the index changes should be replicated to the other nodes in the cluster.
-
deIndexWorklogs
Description copied from interface:IssueIndexingService
Remove a set of worklogs from the search index.- Specified by:
deIndexWorklogs
in interfaceIssueIndexingService
- Parameters:
worklogsToDeIndex
- set ofWithId
s to deIndex.shouldReplicate
- whether or not the index changes should be replicated to the other nodes in the cluster.
-
reIndex
Description copied from interface:IssueIndexManager
Reindex an issue (eg. after field updates).- Specified by:
reIndex
in interfaceIssueIndexingService
- Specified by:
reIndex
in interfaceIssueIndexManager
- Throws:
IndexException
-
reIndex
Description copied from interface:IssueIndexManager
Reindex an issue (eg. after field updates).- Specified by:
reIndex
in interfaceIssueIndexManager
-
reIndex
Description copied from interface:IssueIndexManager
Reindex an issue (eg. after field updates).- Specified by:
reIndex
in interfaceIssueIndexingService
- Specified by:
reIndex
in interfaceIssueIndexManager
-
reIndex
Description copied from interface:IssueIndexManager
Reindex an issue (eg. after field updates).- Specified by:
reIndex
in interfaceIssueIndexManager
- Throws:
IndexException
-
hold
public void hold()Description copied from interface:IssueIndexManager
Temporarily suspend indexing on this thread. All index requests will be queued and processed when release is called.- Specified by:
hold
in interfaceIssueIndexManager
-
isHeld
public boolean isHeld()Description copied from interface:IssueIndexManager
Return true if the index is held.- Specified by:
isHeld
in interfaceIssueIndexManager
-
release
Description copied from interface:IssueIndexManager
Release indexing on this thread. All queued index requests will be processed.- Specified by:
release
in interfaceIssueIndexManager
- Returns:
- Reindex time in ms.
- Throws:
IndexException
- if an error occurs
-
reIndexIssues
Description copied from interface:IssueIndexManager
Reindex a list of issues, passing an optional event that will be set progress- Specified by:
reIndexIssues
in interfaceIssueIndexingService
- Specified by:
reIndexIssues
in 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:IssueIndexManager
Reindex 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:
reIndexIssues
in 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:IssueIndexManager
Reindex 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:
reIndexIssues
in interfaceIssueIndexingService
- Specified by:
reIndexIssues
in 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:IssueIndexingService
Reindex 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:
reIndexIssues
in 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:IssueIndexManager
Reindexes a collection of comments.- Specified by:
reIndexComments
in interfaceIssueIndexingService
- Specified by:
reIndexComments
in interfaceIssueIndexManager
- Parameters:
comments
- a collection of Comment- Throws:
IndexException
-
reIndexComments
Description copied from interface:IssueIndexManager
Reindexes a collection of comments.- Specified by:
reIndexComments
in interfaceIssueIndexingService
- Specified by:
reIndexComments
in 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:IssueIndexManager
Reindexes a collection of comments.- Specified by:
reIndexComments
in interfaceIssueIndexingService
- Specified by:
reIndexComments
in 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:IssueIndexManager
Reindexes a collection of worklogs.- Specified by:
reIndexWorklogs
in interfaceIssueIndexingService
- Specified by:
reIndexWorklogs
in interfaceIssueIndexManager
- Parameters:
worklogs
- a collection of Worklogs- Throws:
IndexException
-
reIndexWorklogs
Description copied from interface:IssueIndexManager
Reindexes a collection of worklogs.- Specified by:
reIndexWorklogs
in interfaceIssueIndexingService
- Specified by:
reIndexWorklogs
in 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:IssueIndexManager
Reindexes a collection of worklogs.- Specified by:
reIndexWorklogs
in interfaceIssueIndexingService
- Specified by:
reIndexWorklogs
in 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:
isIndexConsistent
in interfaceIndexLifecycleManager
- Returns:
- the result of a simple consistency check that compares the index state to
the current number of issues. A background re-index should not be attempted
when this returns
false
. Note thatfalse
is also returned if the index is not available .
-
getLatestIndexDate
Description copied from interface:IssueIndexManager
Gets the latest index date based on the most recent issue updated date.- Specified by:
getLatestIndexDate
in 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:
size
in interfaceIndexLifecycleManager
- Specified by:
size
in 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:IndexLifecycleManager
Optimize the underlying indexes. Make the subsequent searching more efficient.- Specified by:
optimize
in 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:IssueIndexingService
Remove an issue from the search index.- Specified by:
deIndex
in interfaceIssueIndexingService
- Throws:
IndexException
-
deIndexIssueObjectsById
Description copied from interface:IssueIndexingService
Remove a set of issues from the search index.- Specified by:
deIndexIssueObjectsById
in interfaceIssueIndexingService
- Parameters:
issuesToDelete
- set ofWithId
s to deIndex.shouldReplicate
- whether or not the index changes should be replicated to the other nodes in the cluster.
-
deIndex
Description copied from interface:IssueIndexManager
Remove an issue from the search index.- Specified by:
deIndex
in interfaceIssueIndexManager
- Throws:
IndexException
-
conditionalUpdateWithVersion
public void conditionalUpdateWithVersion(IndexDirectoryFactory.Name indexName, org.apache.lucene.document.Document document) Description copied from interface:InternalIndexingService
Index aDocument
conditionally based on the entity id and the version which are resolved byIndexDirectoryFactory.Name.getEntityIdFromDocument(Document)
andIndexDirectoryFactory.Name.getEntityVersionFromDocument(Document)
- Specified by:
conditionalUpdateWithVersion
in 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:InternalIndexingService
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)
- Specified by:
conditionalUpdateWithVersion
in 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:InternalIndexingService
Unconditionally 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:
unconditionallyReindexIssuesAndRelatedEntitiesLocally
in interfaceInternalIndexingService
- Parameters:
issueObjects
- issues need to be re-indexed unconditionally locally
-
getPluginsRootPath
Description copied from interface:IssueIndexManager
Get 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:
getPluginsRootPath
in interfaceIssueIndexManager
-
getExistingPluginsPaths
Description copied from interface:IssueIndexManager
Returns 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:
getExistingPluginsPaths
in interfaceIssueIndexManager
-
getIssueSearcher
Description copied from interface:IssueIndexManager
Get anIndexSearcher
that can be used to search the issue index.- Specified by:
getIssueSearcher
in interfaceIssueIndexManager
-
getCommentSearcher
Description copied from interface:IssueIndexManager
Get anIndexSearcher
that can be used to search the comment index.- Specified by:
getCommentSearcher
in interfaceIssueIndexManager
-
getChangeHistorySearcher
Description copied from interface:IssueIndexManager
Get anIndexSearcher
that can be used to search the change history index.- Specified by:
getChangeHistorySearcher
in interfaceIssueIndexManager
-
getWorklogSearcher
Description copied from interface:IssueIndexManager
Get anIndexSearcher
that can be used to search the worklog index.- Specified by:
getWorklogSearcher
in interfaceIssueIndexManager
-
getEntitySearcher
Description copied from interface:InternalIndexingService
Get anIndexSearcher
that can be used to search the index specified by theIndexDirectoryFactory.Name
.- Specified by:
getEntitySearcher
in 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:InternalIndexingService
Reindexes 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:
reindexIssuesBatchMode
in 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:InternalIndexingService
Reindexes 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:
reindexCommentsInParallel
in 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:InternalIndexingService
Reindexes 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:
reindexWorklogsInParallel
in 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:
getAllIndexPaths
in interfaceIndexLifecycleManager
- Returns:
- a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.
-
shutdown
public void shutdown()Description copied from interface:IndexLifecycleManager
Shuts down the indexing manager and closes its resources (if any).- Specified by:
shutdown
in interfaceIndexLifecycleManager
- Specified by:
shutdown
in interfaceShutdown
-
toString
-