Search in sources :

Example 1 with ElasticIndexWriterFactory

use of org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexWriterFactory in project jackrabbit-oak by apache.

the class ElasticIndexerTest method nodeIndexed_WithIncludedPaths.

@Test
public void nodeIndexed_WithIncludedPaths() throws Exception {
    ElasticIndexDefinitionBuilder idxb = new ElasticIndexDefinitionBuilder();
    idxb.indexRule("nt:base").property("foo").propertyIndex();
    idxb.includedPaths("/content");
    NodeState defn = idxb.build();
    IndexDefinition idxDefn = new ElasticIndexDefinition(root, defn, "/oak:index/testIndex", "testPrefix");
    NodeBuilder builder = root.builder();
    FulltextIndexWriter indexWriter = new ElasticIndexWriterFactory(mock(ElasticConnection.class), mock(ElasticIndexTracker.class)).newInstance(idxDefn, defn.builder(), CommitInfo.EMPTY, false);
    ElasticIndexer indexer = new ElasticIndexer(idxDefn, mock(FulltextBinaryTextExtractor.class), builder, mock(IndexingProgressReporter.class), indexWriter, mock(ElasticIndexEditorProvider.class), mock(IndexHelper.class));
    NodeState testNode = EMPTY_NODE.builder().setProperty("foo", "bar").getNodeState();
    assertTrue(indexer.index(new NodeStateEntry.NodeStateEntryBuilder(testNode, "/content/x").build()));
    assertFalse(indexer.index(new NodeStateEntry.NodeStateEntryBuilder(testNode, "/x").build()));
    assertFalse(indexer.index(new NodeStateEntry.NodeStateEntryBuilder(testNode, "/").build()));
}
Also used : ElasticIndexWriterFactory(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexWriterFactory) IndexHelper(org.apache.jackrabbit.oak.index.IndexHelper) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) FulltextBinaryTextExtractor(org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor) IndexDefinition(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition) ElasticIndexDefinition(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition) FulltextIndexWriter(org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexWriter) IndexingProgressReporter(org.apache.jackrabbit.oak.plugins.index.progress.IndexingProgressReporter) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider) ElasticIndexDefinitionBuilder(org.apache.jackrabbit.oak.plugins.index.elastic.util.ElasticIndexDefinitionBuilder) ElasticIndexDefinition(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition) Test(org.junit.Test)

Aggregations

IndexHelper (org.apache.jackrabbit.oak.index.IndexHelper)1 ElasticIndexDefinition (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition)1 ElasticIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)1 ElasticIndexWriterFactory (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexWriterFactory)1 ElasticIndexDefinitionBuilder (org.apache.jackrabbit.oak.plugins.index.elastic.util.ElasticIndexDefinitionBuilder)1 IndexingProgressReporter (org.apache.jackrabbit.oak.plugins.index.progress.IndexingProgressReporter)1 IndexDefinition (org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition)1 FulltextBinaryTextExtractor (org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor)1 FulltextIndexWriter (org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexWriter)1 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)1 Test (org.junit.Test)1