use of org.apache.jackrabbit.oak.plugins.index.lucene.directory.DefaultDirectoryFactory in project jackrabbit-oak by apache.
the class AggregateTest method propOneLevelNamedDirect.
@Test
public void propOneLevelNamedDirect() throws Exception {
IndexDefinitionBuilder builder = new IndexDefinitionBuilder();
builder.indexRule("nt:folder").property("jcr:content/a").ordered(PropertyType.TYPENAME_LONG).propertyIndex().property("jcr:content/b").ordered(PropertyType.TYPENAME_LONG).propertyIndex();
IndexDefinition defn = new IndexDefinition(root, builder.build(), "/foo");
Aggregate ag = defn.getApplicableIndexingRule("nt:folder").getAggregate();
NodeBuilder nb = newNode("nt:folder");
nb.child("jcr:content").setProperty("a", 1);
nb.child("jcr:content").setProperty("b", 1);
LuceneDocumentMaker maker = new LuceneDocumentMaker(defn, defn.getApplicableIndexingRule("nt:folder"), "/bar");
Document doc = maker.makeDocument(nb.getNodeState());
DirectoryFactory directoryFactory = new DefaultDirectoryFactory(null, null);
DefaultIndexWriterFactory writerFactory = new DefaultIndexWriterFactory(Mounts.defaultMountInfoProvider(), directoryFactory, new LuceneIndexWriterConfig());
LuceneIndexWriter writer = writerFactory.newInstance(defn, EMPTY_NODE.builder(), false);
writer.updateDocument("/bar", doc);
writer.close(100);
}
Aggregations