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());
}
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());
}
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
}
}
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]");
}
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;
}
Aggregations