Package org.apache.jackrabbit.oak.index
Class IndexerSupport
- java.lang.Object
-
- org.apache.jackrabbit.oak.index.IndexerSupport
-
public class IndexerSupport extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected IndexHelperindexHelperstatic StringLOCAL_INDEX_ROOT_DIRDirectory name in output directory under which indexes are stored
-
Constructor Summary
Constructors Constructor Description IndexerSupport(IndexHelper indexHelper, String checkpoint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NodeBuilderchildBuilder(NodeBuilder nb, String path, boolean createNew)longcomputeSizeOfGeneratedIndexData()Computes the total size of the generated index data.FilecopyIndexFilesToOutput()protected voiddumpIndexDefinitions(NodeStore nodeStore)StringgetCheckpoint()Map<String,String>getCheckpointInfo()FilegetExistingDataDumpDir()<T> Predicate<T>getFilterPredicate(List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefinitions, Function<T,String> typeToRepositoryPath)<T> Predicate<T>getFilterPredicateBasedOnCustomRegex(Pattern pattern, Function<T,String> typeToRepositoryPath)List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition>getIndexDefinitions()FilegetLocalIndexDir()longgetMinModified()Set<String>getPreferredPathElements(List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefinitions)voidpostIndexWork(NodeStore copyOnWriteStore)NodeStateretrieveNodeStateForCheckpoint()voidsetIndexDefinitions(File indexDefinitions)voidsetMinModified(long minModified)voidswitchIndexLanesAndReindexFlag(NodeStore copyOnWriteStore)protected voidswitchIndexLanesBack(NodeStore copyOnWriteStore)voidupdateIndexDefinitions(NodeBuilder rootBuilder)IndexerSupportwithExistingDataDumpDir(File existingDataDumpDir)voidwriteMetaInfo(String checkpoint)
-
-
-
Field Detail
-
LOCAL_INDEX_ROOT_DIR
public static final String LOCAL_INDEX_ROOT_DIR
Directory name in output directory under which indexes are stored- See Also:
- Constant Field Values
-
indexHelper
protected final IndexHelper indexHelper
-
-
Constructor Detail
-
IndexerSupport
public IndexerSupport(IndexHelper indexHelper, String checkpoint)
-
-
Method Detail
-
getMinModified
public long getMinModified()
-
setMinModified
public void setMinModified(long minModified)
-
withExistingDataDumpDir
public IndexerSupport withExistingDataDumpDir(File existingDataDumpDir)
-
getExistingDataDumpDir
public File getExistingDataDumpDir()
-
getLocalIndexDir
public File getLocalIndexDir() throws IOException
- Throws:
IOException
-
copyIndexFilesToOutput
public File copyIndexFilesToOutput() throws IOException
- Throws:
IOException
-
writeMetaInfo
public void writeMetaInfo(String checkpoint) throws IOException
- Throws:
IOException
-
getCheckpoint
public String getCheckpoint()
-
retrieveNodeStateForCheckpoint
public NodeState retrieveNodeStateForCheckpoint()
-
updateIndexDefinitions
public void updateIndexDefinitions(NodeBuilder rootBuilder) throws IOException, CommitFailedException
- Throws:
IOExceptionCommitFailedException
-
dumpIndexDefinitions
protected void dumpIndexDefinitions(NodeStore nodeStore) throws IOException
- Throws:
IOException
-
switchIndexLanesAndReindexFlag
public void switchIndexLanesAndReindexFlag(NodeStore copyOnWriteStore) throws CommitFailedException, IOException
- Throws:
CommitFailedExceptionIOException
-
postIndexWork
public void postIndexWork(NodeStore copyOnWriteStore) throws CommitFailedException, IOException
- Throws:
CommitFailedExceptionIOException
-
switchIndexLanesBack
protected void switchIndexLanesBack(NodeStore copyOnWriteStore) throws CommitFailedException
- Throws:
CommitFailedException
-
setIndexDefinitions
public void setIndexDefinitions(File indexDefinitions)
-
childBuilder
public static NodeBuilder childBuilder(NodeBuilder nb, String path, boolean createNew)
-
getIndexDefinitions
public List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> getIndexDefinitions() throws IOException, CommitFailedException
- Throws:
IOExceptionCommitFailedException
-
getPreferredPathElements
public Set<String> getPreferredPathElements(List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefinitions)
- Returns:
- set of preferred path elements referred from the given set of index definitions.
-
getFilterPredicate
public <T> Predicate<T> getFilterPredicate(List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefinitions, Function<T,String> typeToRepositoryPath)
- Parameters:
indexDefinitions- set of IndexDefinition to be used to calculate the Path PredicatetypeToRepositoryPath- Function to convert typeto valid repository path of type - Returns:
- filter predicate based on the include/exclude path rules of the given set of index definitions.
-
getFilterPredicateBasedOnCustomRegex
public <T> Predicate<T> getFilterPredicateBasedOnCustomRegex(Pattern pattern, Function<T,String> typeToRepositoryPath)
- Parameters:
pattern- Pattern for a custom excludes regex based on which paths would be filtered outtypeToRepositoryPath- Function to convert typeto valid repository path of type - Returns:
- Return a predicate that should test true for all paths that do not match the provided regex pattern.
-
computeSizeOfGeneratedIndexData
public long computeSizeOfGeneratedIndexData()
Computes the total size of the generated index data. This method is intended to be used when creating Lucene indexes, which are created locally. With Elastic, this will not include the Lucene files since the indexes are updated remotely.- Returns:
- The total size of the index data generated or -1 if there is some error while computing the size.
-
-