public class

IndexUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.index.ha.IndexUtils

Class Overview

Helper methods to work with LuceneIndexes.

Summary

Nested Classes
enum IndexUtils.IndexPath Represents the paths in jira home where indexes are stored  
Fields
public static final PatternFilenameFilter INDEX_SNAPSHOT_FILTER
Public Constructors
IndexUtils(IssueIndexManager issueIndexManager, LuceneDirectoryUtils luceneDirectoryUtils, EventPublisher eventPublisher)
Public Methods
Map<IndexUtils.IndexPath, IndexUtils.IndexPathMapping> buildIndexPathMappings(String sourcePath, String destinationPath)
Builds a mapping from the source index filepath to the destination filepath - keyed by the type of index
void clearIndex(String path)
This deletes all documents in all indexes (if they exist)
void copyIndexes(String sourcePath, String destinationPath)
Copies all indexes from a specified directory to another specified directory.
String takeIndexSnapshot(String sourcePath, String destinationPath, String snapshotId, int maxSnapshots, IndexSnapshotContribution contribution)
Protected Methods
int deleteOldSnapshots(File directory, int numToKeep)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final PatternFilenameFilter INDEX_SNAPSHOT_FILTER

Public Constructors

public IndexUtils (IssueIndexManager issueIndexManager, LuceneDirectoryUtils luceneDirectoryUtils, EventPublisher eventPublisher)

Public Methods

public Map<IndexUtils.IndexPath, IndexUtils.IndexPathMapping> buildIndexPathMappings (String sourcePath, String destinationPath)

Builds a mapping from the source index filepath to the destination filepath - keyed by the type of index

Parameters
sourcePath the root of the source index
destinationPath the root of the destination index

public void clearIndex (String path)

This deletes all documents in all indexes (if they exist)

Parameters
path the root of the index to clear

public void copyIndexes (String sourcePath, String destinationPath)

Copies all indexes from a specified directory to another specified directory. Any indexes on the destination directory will be deleted.

Parameters
sourcePath source of index files
destinationPath destination of index files

public String takeIndexSnapshot (String sourcePath, String destinationPath, String snapshotId, int maxSnapshots, IndexSnapshotContribution contribution)

Parameters
sourcePath the root of the source index directory
destinationPath the destination directory
snapshotId an ID for the snapshot
maxSnapshots maximum number of snapshots to keep in the destination directory
contribution an additional contribution to include in the snapshot
Returns
  • filename of the snapshot

Protected Methods

protected int deleteOldSnapshots (File directory, int numToKeep)