use of com.enonic.xp.repo.impl.elasticsearch.document.IndexDocument in project xp by enonic.
the class NodeIndexDocumentFactoryTest method index_node_document_created.
@Test
public void index_node_document_created() throws Exception {
Node node = Node.create().id(NodeId.from("abc")).build();
final Collection<IndexDocument> indexDocuments = NodeStoreDocumentFactory.createBuilder().node(node).branch(TEST_BRANCH).repositoryId(TEST_REPOSITORY_ID).build().create();
assertNotNull(indexDocuments);
assertNotNull(getIndexDocumentOfType(indexDocuments, "test"));
}
use of com.enonic.xp.repo.impl.elasticsearch.document.IndexDocument in project xp by enonic.
the class StoreDocumentXContentBuilderFactoryTest method testName.
@Test
public void testName() throws Exception {
final IndexItems indexItems = IndexItems.create().add(IndexPath.from("myProperty"), ValueFactory.newString("myValue"), createDefaultDocument(IndexConfig.MINIMAL)).build();
final IndexDocument indexDocument = IndexDocument.create().analyzer("myAnalyzer").id(NodeId.from("myNodeId").toString()).indexName("myIndex").indexTypeName("myIndexType").indexItems(indexItems).build();
final XContentBuilder xContentBuilder = StoreDocumentXContentBuilderFactory.create(indexDocument);
System.out.println(xContentBuilder.string());
}
use of com.enonic.xp.repo.impl.elasticsearch.document.IndexDocument in project xp by enonic.
the class NodeIndexDocumentFactoryTest method node_index_document_meta_data_values.
@Test
public void node_index_document_meta_data_values() throws Exception {
final String myAnalyzerName = "myAnalyzer";
Node node = Node.create().id(NodeId.from("myId")).parentPath(NodePath.ROOT).name(NodeName.from("my-name")).indexConfigDocument(PatternIndexConfigDocument.create().analyzer(myAnalyzerName).defaultConfig(IndexConfig.MINIMAL).build()).build();
final Collection<IndexDocument> indexDocuments = NodeStoreDocumentFactory.createBuilder().node(node).branch(TEST_BRANCH).repositoryId(TEST_REPOSITORY_ID).build().create();
final IndexDocument indexDocument = getIndexDocumentOfType(indexDocuments, "test");
assertEquals(myAnalyzerName, indexDocument.getAnalyzer());
assertEquals(IndexNameResolver.resolveSearchIndexName(TEST_REPOSITORY_ID), indexDocument.getIndexName());
assertEquals("test", indexDocument.getIndexTypeName());
}
Aggregations