use of org.apache.jackrabbit.oak.plugins.index.search.spi.editor.FulltextIndexWriter 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()));
}
Aggregations