use of org.apache.jackrabbit.oak.plugins.index.IndexInfo in project jackrabbit-oak by apache.
the class IndexPrinter method printIndexInfo.
private void printIndexInfo(PrintWriter pw) {
ListMultimap<String, IndexInfo> infos = ArrayListMultimap.create();
for (IndexInfo info : indexInfoService.getAllIndexInfo()) {
infos.put(info.getType(), info);
}
pw.printf("Total number of indexes : %d%n", infos.size());
for (String type : infos.keySet()) {
List<IndexInfo> typedInfo = infos.get(type);
String title = String.format("%s(%d)", type, typedInfo.size());
printTitle(pw, title);
pw.println();
for (IndexInfo info : typedInfo) {
printIndexInfo(pw, info);
}
}
}
use of org.apache.jackrabbit.oak.plugins.index.IndexInfo in project jackrabbit-oak by apache.
the class PropertyIndexInfoProviderTest method emptyIndexEstimate.
@Test
public void emptyIndexEstimate() throws Exception {
NodeBuilder builder = store.getRoot().builder();
NodeBuilder index = createIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "foo", true, false, ImmutableSet.of("foo"), null);
store.merge(builder, HOOK, CommitInfo.EMPTY);
IndexInfo info = infoProvider.getInfo("/oak:index/foo");
assertNotNull(info);
assertEquals("/oak:index/foo", info.getIndexPath());
assertEquals("property", info.getType());
assertEquals(-2, info.getLastUpdatedTime());
assertEquals(0, info.getEstimatedEntryCount());
}
use of org.apache.jackrabbit.oak.plugins.index.IndexInfo in project jackrabbit-oak by apache.
the class LuceneIndexInfoProviderTest method info.
@Test
public void info() throws Exception {
IndexDefinitionBuilder defnBuilder = new IndexDefinitionBuilder();
NodeBuilder builder = store.getRoot().builder();
builder.child("oak:index").setChildNode("fooIndex", defnBuilder.build());
store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
when(asyncService.getInfo("async")).thenReturn(new AsyncIndexInfo("async", 0, 0, false, null));
IndexInfo info = provider.getInfo("/oak:index/fooIndex");
assertNotNull(info);
}
use of org.apache.jackrabbit.oak.plugins.index.IndexInfo in project jackrabbit-oak by apache.
the class LucenePropertyIndexTest method storedIndexDefinitionDiff.
@Test
public void storedIndexDefinitionDiff() throws Exception {
IndexDefinitionBuilder idxb = new IndexDefinitionBuilder().noAsync();
idxb.indexRule("nt:base").property("foo").propertyIndex();
Tree idx = root.getTree("/").getChild("oak:index").addChild("test1");
idxb.build(idx);
root.commit();
AsyncIndexInfoService asyncService = new AsyncIndexInfoServiceImpl(nodeStore);
LuceneIndexInfoProvider indexInfoProvider = new LuceneIndexInfoProvider(nodeStore, asyncService, temporaryFolder.newFolder());
IndexInfo info = indexInfoProvider.getInfo("/oak:index/test1");
assertNotNull(info);
assertFalse(info.hasIndexDefinitionChangedWithoutReindexing());
assertNull(info.getIndexDefinitionDiff());
Tree idxTree = root.getTree("/oak:index/test1");
idxTree.setProperty("foo", "bar");
root.commit();
info = indexInfoProvider.getInfo("/oak:index/test1");
assertTrue(info.hasIndexDefinitionChangedWithoutReindexing());
assertNotNull(info.getIndexDefinitionDiff());
}
Aggregations