Search in sources :

Example 1 with QueryEngineSettings

use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.

the class ReferenceIndexTest method createFilter.

@SuppressWarnings("Duplicates")
private static FilterImpl createFilter(NodeState root, String nodeTypeName) {
    NodeTypeInfoProvider nodeTypes = new NodeStateNodeTypeInfoProvider(root);
    NodeTypeInfo type = nodeTypes.getNodeTypeInfo(nodeTypeName);
    SelectorImpl selector = new SelectorImpl(type, nodeTypeName);
    return new FilterImpl(selector, "SELECT * FROM [" + nodeTypeName + "]", new QueryEngineSettings());
}
Also used : FilterImpl(org.apache.jackrabbit.oak.query.index.FilterImpl) NodeTypeInfo(org.apache.jackrabbit.oak.query.ast.NodeTypeInfo) SelectorImpl(org.apache.jackrabbit.oak.query.ast.SelectorImpl) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider) NodeTypeInfoProvider(org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider) NodeStateNodeTypeInfoProvider(org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)

Example 2 with QueryEngineSettings

use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.

the class CursorsTest method intersectionCursor.

@Test
public void intersectionCursor() {
    QueryEngineSettings s = new QueryEngineSettings();
    Cursor a = new SimpleCursor("1:", "/b", "/c", "/e", "/e", "/c");
    Cursor b = new SimpleCursor("2:", "/a", "/c", "/d", "/b", "/c");
    Cursor c = Cursors.newIntersectionCursor(a, b, s);
    assertEquals("1:/b, 1:/c", list(c));
    assertFalse(c.hasNext());
}
Also used : QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) Test(org.junit.Test)

Example 3 with QueryEngineSettings

use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.

the class CursorsTest method intersectionCursorExceptions.

@Test
public void intersectionCursorExceptions() {
    QueryEngineSettings s = new QueryEngineSettings();
    Cursor a = new SimpleCursor("1:", "/x", "/b", "/c", "/e", "/e", "/c");
    Cursor b = new SimpleCursor("2:", "/a", "/c", "/d", "/b", "/c");
    Cursor c = Cursors.newIntersectionCursor(a, b, s);
    c.next();
    c.next();
    try {
        c.remove();
        fail();
    } catch (UnsupportedOperationException e) {
    // expected
    }
    try {
        c.next();
        fail();
    } catch (IllegalStateException e) {
    // expected
    }
}
Also used : QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) Test(org.junit.Test)

Example 4 with QueryEngineSettings

use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.

the class AdvancedIndexTest method copy.

@Test
public void copy() throws Exception {
    Filter f = new FilterImpl(null, "SELECT * FROM [nt:file]", new QueryEngineSettings());
    IndexPlan.Builder b = new IndexPlan.Builder();
    IndexPlan plan1 = b.setEstimatedEntryCount(10).setFilter(f).setDelayed(true).build();
    IndexPlan plan2 = plan1.copy();
    plan2.setFilter(new FilterImpl(null, "SELECT * FROM [oak:Unstructured]", new QueryEngineSettings()));
    assertEquals(plan1.getEstimatedEntryCount(), 10);
    assertEquals(plan2.getEstimatedEntryCount(), 10);
    assertTrue(plan1.isDelayed());
    assertTrue(plan2.isDelayed());
    assertEquals(plan1.getFilter().getQueryStatement(), "SELECT * FROM [nt:file]");
    assertEquals(plan2.getFilter().getQueryStatement(), "SELECT * FROM [oak:Unstructured]");
}
Also used : Filter(org.apache.jackrabbit.oak.spi.query.Filter) IndexPlan(org.apache.jackrabbit.oak.spi.query.QueryIndex.IndexPlan) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) Test(org.junit.Test)

Example 5 with QueryEngineSettings

use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.

the class HybridIndexClusterIT method customize.

@Override
protected Jcr customize(Jcr jcr) {
    IndexCopier copier;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    MountInfoProvider mip = defaultMountInfoProvider();
    NRTIndexFactory nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
    LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
    IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
    LuceneIndexProvider provider = new LuceneIndexProvider(tracker);
    DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, tracker, null, null, mip);
    editorProvider.setIndexingQueue(queue);
    LocalIndexObserver localIndexObserver = new LocalIndexObserver(queue, StatisticsProvider.NOOP);
    ExternalIndexObserver externalIndexObserver = new ExternalIndexObserver(queue, tracker, StatisticsProvider.NOOP);
    QueryEngineSettings qs = new QueryEngineSettings();
    qs.setFailTraversal(true);
    jcr.with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(externalIndexObserver).with(editorProvider).with(qs).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    return jcr;
}
Also used : IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) IOException(java.io.IOException) LuceneIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) Mounts.defaultMountInfoProvider(org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Aggregations

QueryEngineSettings (org.apache.jackrabbit.oak.query.QueryEngineSettings)49 SelectorImpl (org.apache.jackrabbit.oak.query.ast.SelectorImpl)29 FilterImpl (org.apache.jackrabbit.oak.query.index.FilterImpl)29 Test (org.junit.Test)24 QueryIndex (org.apache.jackrabbit.oak.spi.query.QueryIndex)17 LinkedList (java.util.LinkedList)14 NodeStateNodeTypeInfoProvider (org.apache.jackrabbit.oak.query.NodeStateNodeTypeInfoProvider)12 NodeTypeInfo (org.apache.jackrabbit.oak.query.ast.NodeTypeInfo)12 NodeTypeInfoProvider (org.apache.jackrabbit.oak.query.ast.NodeTypeInfoProvider)12 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)10 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)5 Cursor (org.apache.jackrabbit.oak.spi.query.Cursor)4 Before (org.junit.Before)4 SimpleCredentials (javax.jcr.SimpleCredentials)3 DefaultSolrConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfiguration)3 OakSolrConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration)3 OakSolrConfigurationProvider (org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfigurationProvider)3 SolrServerProvider (org.apache.jackrabbit.oak.plugins.index.solr.server.SolrServerProvider)3 ConfigurationParameters (org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)3 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)3