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