use of org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider in project jackrabbit-oak by apache.
the class IndexTrackerTest method setUp.
@Before
public void setUp() {
IndexUpdateProvider updateProvider = new IndexUpdateProvider(new LuceneIndexEditorProvider(), "async", false);
updateProvider.setCorruptIndexHandler(corruptIndexHandler);
hook = new EditorHook(updateProvider);
}
use of org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider in project jackrabbit-oak by apache.
the class SolrBaseTest method setUp.
@Before
public void setUp() throws Exception {
store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
provider = new TestUtils();
server = provider.getSolrServer();
configuration = provider.getConfiguration();
hook = new EditorHook(new IndexUpdateProvider(new SolrIndexEditorProvider(provider, provider)));
Oak oak = new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(// synchronous
new SolrIndexInitializer(false)).with(new SolrQueryIndexProvider(provider, provider)).with(new NodeStateSolrServersObserver()).with(new SolrIndexEditorProvider(provider, provider));
repository = oak.createContentRepository();
}
use of org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider in project jackrabbit-oak by apache.
the class LocalIndexWriterFactoryTest method setUp.
@Before
public void setUp() throws IOException {
tracker = new IndexTracker();
DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
editorProvider = new LuceneIndexEditorProvider(null, null, null, Mounts.defaultMountInfoProvider());
editorProvider.setIndexingQueue(queue);
syncHook = new EditorHook(new IndexUpdateProvider(editorProvider));
asyncHook = new EditorHook(new IndexUpdateProvider(editorProvider, "async", false));
}
use of org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider in project jackrabbit-oak by apache.
the class NodeTypeIndexTest method nodeType.
@Test
public void nodeType() throws Exception {
NodeBuilder root = store.getRoot().builder();
// remove "rep:security" as it interferes with tests
root.getChildNode("rep:security").remove();
// set "entryCount", so the node type index counts the nodes
// and the approximation is not used
root.getChildNode("oak:index").getChildNode("nodetype").setProperty("entryCount", -1);
addFolder(root, "folder-1");
addFolder(root, "folder-2");
addFile(root, "file-1");
store.merge(root, new EditorHook(new IndexUpdateProvider(new PropertyIndexEditorProvider())), CommitInfo.EMPTY);
NodeState rootState = store.getRoot();
NodeTypeIndex index = new NodeTypeIndex(Mounts.defaultMountInfoProvider());
FilterImpl filter;
filter = createFilter(rootState, JcrConstants.NT_FOLDER);
assertEquals(6.0, index.getCost(filter, rootState), 0.0);
checkCursor(index.query(filter, rootState), "/folder-1", "/folder-2");
filter = createFilter(rootState, JcrConstants.NT_FILE);
assertEquals(5.0, index.getCost(filter, rootState), 0.0);
checkCursor(index.query(filter, rootState), "/file-1");
filter = createFilter(rootState, JcrConstants.NT_HIERARCHYNODE);
assertEquals(7.0, index.getCost(filter, rootState), 0.0);
checkCursor(index.query(filter, rootState), "/folder-1", "/folder-2", "/file-1");
}
use of org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider in project jackrabbit-oak by apache.
the class ReferenceIndexTest method referenceHandlingWithMounts.
@Test
public void referenceHandlingWithMounts() throws Exception {
NodeState root = INITIAL_CONTENT;
NodeBuilder builder = root.builder();
NodeState before = builder.getNodeState();
builder.child("a").child("x").setProperty(createProperty("foo", "u1", Type.REFERENCE));
builder.child("b").setProperty(createProperty("foo", "u1", Type.REFERENCE));
builder.child("c").setProperty(createProperty("foo", "u1", Type.WEAKREFERENCE));
builder.child("d").setProperty(createProperty("foo", "u2", Type.WEAKREFERENCE));
builder.child("a").child("y").setProperty(createProperty("foo", "u1", Type.WEAKREFERENCE));
NodeState after = builder.getNodeState();
MountInfoProvider mip = Mounts.newBuilder().mount("foo", "/a").build();
EditorHook hook = new EditorHook(new IndexUpdateProvider(new ReferenceEditorProvider().with(mip)));
ReferenceIndex referenceIndex = new ReferenceIndex(mip);
NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY);
FilterImpl f = createFilter(indexed, NT_BASE);
f.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.REFERENCE);
// System.out.println(NodeStateUtils.toString(NodeStateUtils.getNode(indexed, "/oak:index/reference")));
assertFilter(f, referenceIndex, indexed, of("/a/x", "/b"));
FilterImpl f2 = createFilter(indexed, NT_BASE);
f2.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.WEAKREFERENCE);
assertFilter(f2, referenceIndex, indexed, of("/c", "/a/y"));
}
Aggregations