Search in sources :

Example 1 with ReindexResult

use of com.enonic.xp.index.ReindexResult in project xp by enonic.

the class IndexServiceImplTest method purge_then_reindex.

@Test
public void purge_then_reindex() throws Exception {
    final Node node = createNode(CreateNodeParams.create().name("myNode").parent(NodePath.ROOT).build());
    refresh();
    this.indexService.purgeSearchIndex(new PurgeIndexParams(TEST_REPO_ID));
    assertNull(queryForNode(node.id()));
    final ReindexResult result = this.indexService.reindex(ReindexParams.create().addBranch(WS_DEFAULT).repositoryId(TEST_REPO_ID).initialize(false).build());
    assertEquals(2, result.getReindexNodes().getSize());
    refresh();
    assertNotNull(queryForNode(node.id()));
    assertNotNull(queryForNode(rootNode.id()));
}
Also used : ReindexResult(com.enonic.xp.index.ReindexResult) Node(com.enonic.xp.node.Node) PurgeIndexParams(com.enonic.xp.index.PurgeIndexParams) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 2 with ReindexResult

use of com.enonic.xp.index.ReindexResult in project xp by enonic.

the class ReindexRunnableTask method run.

@Override
public void run(final TaskId id, final ProgressReporter progressReporter) {
    final ReindexResult result = this.indexService.reindex(ReindexParams.create().setBranches(parseBranches(params.branches)).listener(new ReindexListenerImpl(progressReporter)).initialize(params.initialize).repositoryId(parseRepositoryId(params.repository)).build());
    progressReporter.info(ReindexResultJson.create(result).toString());
}
Also used : ReindexResult(com.enonic.xp.index.ReindexResult) ReindexListenerImpl(com.enonic.xp.impl.server.rest.task.listener.ReindexListenerImpl)

Example 3 with ReindexResult

use of com.enonic.xp.index.ReindexResult in project xp by enonic.

the class IndexServiceImplTest method not_initialize.

@Test
public void not_initialize() throws Exception {
    final Node node = createNode(CreateNodeParams.create().name("myNode").parent(NodePath.ROOT).build());
    refresh();
    final ReindexResult result = this.indexService.reindex(ReindexParams.create().addBranch(WS_DEFAULT).repositoryId(TEST_REPO_ID).initialize(false).build());
    assertEquals(2, result.getReindexNodes().getSize());
    assertNotNull(queryForNode(node.id()));
    assertNotNull(queryForNode(rootNode.id()));
}
Also used : ReindexResult(com.enonic.xp.index.ReindexResult) Node(com.enonic.xp.node.Node) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 4 with ReindexResult

use of com.enonic.xp.index.ReindexResult in project xp by enonic.

the class ReindexLoadTest method load.

@Test
public void load() {
    final int loadSize = 10_100;
    for (int i = 0; i < loadSize; i++) {
        createNode(CreateNodeParams.create().name("node" + i).parent(NodePath.ROOT).build(), false);
    }
    refresh();
    final ReindexResult result = this.indexService.reindex(ReindexParams.create().addBranch(WS_DEFAULT).repositoryId(TEST_REPO_ID).initialize(true).build());
    assertEquals(loadSize + 1, result.getReindexNodes().getSize());
}
Also used : ReindexResult(com.enonic.xp.index.ReindexResult) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Example 5 with ReindexResult

use of com.enonic.xp.index.ReindexResult in project xp by enonic.

the class IndexServiceImplTest method initialize.

@Test
public void initialize() throws Exception {
    final Node node = createNode(CreateNodeParams.create().name("myNode").parent(NodePath.ROOT).build());
    refresh();
    final ReindexResult result = this.indexService.reindex(ReindexParams.create().addBranch(WS_DEFAULT).repositoryId(TEST_REPO_ID).initialize(true).build());
    refresh();
    assertEquals(2, result.getReindexNodes().getSize());
    assertNotNull(queryForNode(node.id()));
    assertNotNull(queryForNode(rootNode.id()));
}
Also used : ReindexResult(com.enonic.xp.index.ReindexResult) Node(com.enonic.xp.node.Node) Test(org.junit.jupiter.api.Test) AbstractNodeTest(com.enonic.xp.repo.impl.node.AbstractNodeTest)

Aggregations

ReindexResult (com.enonic.xp.index.ReindexResult)7 Test (org.junit.jupiter.api.Test)5 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)4 Node (com.enonic.xp.node.Node)3 Branch (com.enonic.xp.branch.Branch)1 ReindexListenerImpl (com.enonic.xp.impl.server.rest.task.listener.ReindexListenerImpl)1 PurgeIndexParams (com.enonic.xp.index.PurgeIndexParams)1 ReindexParams (com.enonic.xp.index.ReindexParams)1