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 IndexHelper
indexHelper
static String
LOCAL_INDEX_ROOT_DIR
Directory 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 NodeBuilder
childBuilder(NodeBuilder nb, String path, boolean createNew)
long
computeSizeOfGeneratedIndexData()
Computes the total size of the generated index data.File
copyIndexFilesToOutput()
protected void
dumpIndexDefinitions(NodeStore nodeStore)
String
getCheckpoint()
Map<String,String>
getCheckpointInfo()
File
getExistingDataDumpDir()
<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()
File
getLocalIndexDir()
long
getMinModified()
Set<String>
getPreferredPathElements(List<org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition> indexDefinitions)
void
postIndexWork(NodeStore copyOnWriteStore)
NodeState
retrieveNodeStateForCheckpoint()
void
setIndexDefinitions(File indexDefinitions)
void
setMinModified(long minModified)
void
switchIndexLanesAndReindexFlag(NodeStore copyOnWriteStore)
protected void
switchIndexLanesBack(NodeStore copyOnWriteStore)
void
updateIndexDefinitions(NodeBuilder rootBuilder)
IndexerSupport
withExistingDataDumpDir(File existingDataDumpDir)
void
writeMetaInfo(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:
IOException
CommitFailedException
-
dumpIndexDefinitions
protected void dumpIndexDefinitions(NodeStore nodeStore) throws IOException
- Throws:
IOException
-
switchIndexLanesAndReindexFlag
public void switchIndexLanesAndReindexFlag(NodeStore copyOnWriteStore) throws CommitFailedException, IOException
- Throws:
CommitFailedException
IOException
-
postIndexWork
public void postIndexWork(NodeStore copyOnWriteStore) throws CommitFailedException, IOException
- Throws:
CommitFailedException
IOException
-
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:
IOException
CommitFailedException
-
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.
-
-