Search in sources :

Example 6 with DefaultDirectoryFactory

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);
}
Also used : LuceneIndexWriterConfig(org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriterConfig) LuceneIndexWriter(org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriter) IndexDefinitionBuilder(org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder) DirectoryFactory(org.apache.jackrabbit.oak.plugins.index.lucene.directory.DirectoryFactory) DefaultDirectoryFactory(org.apache.jackrabbit.oak.plugins.index.lucene.directory.DefaultDirectoryFactory) DefaultIndexWriterFactory(org.apache.jackrabbit.oak.plugins.index.lucene.writer.DefaultIndexWriterFactory) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Document(org.apache.lucene.document.Document) DefaultDirectoryFactory(org.apache.jackrabbit.oak.plugins.index.lucene.directory.DefaultDirectoryFactory) Test(org.junit.Test)

Aggregations

DefaultDirectoryFactory (org.apache.jackrabbit.oak.plugins.index.lucene.directory.DefaultDirectoryFactory)6 DirectoryFactory (org.apache.jackrabbit.oak.plugins.index.lucene.directory.DirectoryFactory)4 Test (org.junit.Test)4 DefaultIndexWriterFactory (org.apache.jackrabbit.oak.plugins.index.lucene.writer.DefaultIndexWriterFactory)3 LuceneIndexWriter (org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriter)3 CachingFileDataStore (org.apache.jackrabbit.oak.plugins.blob.datastore.CachingFileDataStore)2 DataStoreBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)2 LuceneIndexWriterConfig (org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriterConfig)2 LuceneIndexWriterFactory (org.apache.jackrabbit.oak.plugins.index.lucene.writer.LuceneIndexWriterFactory)2 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)2 Document (org.apache.lucene.document.Document)2 IndexReader (org.apache.lucene.index.IndexReader)2 Directory (org.apache.lucene.store.Directory)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 DefaultIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)1 LuceneIndexReader (org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReader)1 LuceneIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory)1 IndexDefinitionBuilder (org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder)1 LuceneIndexHelper.newLucenePropertyIndexDefinition (org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneIndexHelper.newLucenePropertyIndexDefinition)1 AbstractQueryTest (org.apache.jackrabbit.oak.query.AbstractQueryTest)1