Package com.atlassian.jira.sharing.index
Class DefaultSharedEntityIndexManager
java.lang.Object
com.atlassian.jira.sharing.index.DefaultSharedEntityIndexManager
- All Implemented Interfaces:
BackupContributor
,SharedEntityIndexManager
,Sized
,IndexLifecycleManager
,Shutdown
Default IndexManager for
shared entities
- Since:
- v3.13
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSharedEntityIndexManager
(SharedEntityIndexer indexer, SearchRequestManager searchRequestManager, PortalPageManager portalPageManager, FileFactory fileFactory, ApplicationProperties applicationProperties, IndexBackupContributorsManager indexBackupContributorsManager) -
Method Summary
Modifier and TypeMethodDescriptionlong
Activates search indexes.long
Activates search indexes.void
contributeToBackup
(BackupBuilder backupBuilder) Contribute a set of files to the givenbackupBuilder
to include them in the backup being created when this method was called.void
De-activates indexing (as happens from the admin page) and removes index directories.boolean
isEmpty()
boolean
Whether this index is available.boolean
long
optimize()
Optimize the underlying indexes.long
long
reIndexAll
(Context context) Reindex everything.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
reIndexIssuesInBackground
(Context context, IssueIndexingParams issueIndexingParams) Reindex everything, but don't stop the worldlong
reIndexSharedEntities
(Context context, IssueIndexingParams issueIndexingParams, Set<SharedEntity.TypeDescriptor> sharedEntityTypes) Reindex the specified shared entity types.void
shutdown()
Shuts down the indexing manager and closes its resources (if any).int
size()
toString()
-
Constructor Details
-
Method Details
-
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
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
- Throws:
IndexException
-
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.
-
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.
-
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
-
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
-
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
-
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
-
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.
-
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 .
-
getAllIndexPaths
- Specified by:
getAllIndexPaths
in interfaceIndexLifecycleManager
- Returns:
- a collection of Strings that map to all paths that contain Lucene indexes. Must not be null.
-
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() -
toString
-
contributeToBackup
Description copied from interface:BackupContributor
Contribute a set of files to the givenbackupBuilder
to include them in the backup being created when this method was called.- Specified by:
contributeToBackup
in 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
-