Search in sources :

Example 1 with IndexInfo

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);
        }
    }
}
Also used : IndexInfo(org.apache.jackrabbit.oak.plugins.index.IndexInfo) AsyncIndexInfo(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo)

Example 2 with IndexInfo

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());
}
Also used : IndexInfo(org.apache.jackrabbit.oak.plugins.index.IndexInfo) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 3 with IndexInfo

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);
}
Also used : IndexDefinitionBuilder(org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder) IndexInfo(org.apache.jackrabbit.oak.plugins.index.IndexInfo) AsyncIndexInfo(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) AsyncIndexInfo(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo) Test(org.junit.Test)

Example 4 with IndexInfo

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());
}
Also used : AsyncIndexInfoService(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService) IndexDefinitionBuilder(org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder) Tree(org.apache.jackrabbit.oak.api.Tree) IndexInfo(org.apache.jackrabbit.oak.plugins.index.IndexInfo) AsyncIndexInfoServiceImpl(org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoServiceImpl) Test(org.junit.Test) AbstractQueryTest(org.apache.jackrabbit.oak.query.AbstractQueryTest)

Aggregations

IndexInfo (org.apache.jackrabbit.oak.plugins.index.IndexInfo)4 Test (org.junit.Test)3 AsyncIndexInfo (org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfo)2 IndexDefinitionBuilder (org.apache.jackrabbit.oak.plugins.index.lucene.util.IndexDefinitionBuilder)2 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)2 Tree (org.apache.jackrabbit.oak.api.Tree)1 AsyncIndexInfoService (org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService)1 AsyncIndexInfoServiceImpl (org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoServiceImpl)1 AbstractQueryTest (org.apache.jackrabbit.oak.query.AbstractQueryTest)1