コード例 #1
0
  @Test
  public void create_for_properties_with_multiple_values() throws Exception {
    RootDataSet rootDataSet = new RootDataSet();
    rootDataSet.addProperty(DataPath.from("a.b.c"), Value.newDouble(2.0));
    rootDataSet.addProperty(DataPath.from("a.b.c"), Value.newDouble(3.0));

    Node node = Node.newNode().id(EntityId.from("myId")).rootDataSet(rootDataSet).build();

    final Collection<IndexDocument> indexDocuments =
        NodeIndexDocumentFactory.create(node, TEST_WORKSPACE);

    assertTrue(indexDocuments.iterator().hasNext());
    final IndexDocument next = indexDocuments.iterator().next();

    final Set<AbstractIndexDocumentItem> numberItems =
        getItemsWithName(next, IndexDocumentItemPath.from("a_b_c"), IndexValueType.NUMBER);

    assertEquals(2, numberItems.size());
  }
コード例 #2
0
  @Test
  public void add_properties_then_index_document_items_created_for_each_property()
      throws Exception {
    RootDataSet rootDataSet = new RootDataSet();
    rootDataSet.addProperty(DataPath.from("a.b.c"), Value.newDouble(2.0));
    rootDataSet.setProperty(DataPath.from("a.b.d"), Value.newLocalDate(LocalDate.now()));

    Node node = Node.newNode().id(EntityId.from("myId")).rootDataSet(rootDataSet).build();

    final Collection<IndexDocument> indexDocuments =
        NodeIndexDocumentFactory.create(node, TEST_WORKSPACE);

    final IndexDocument indexDocument = getIndexDocumentOfType(indexDocuments, IndexType.NODE);

    assertNotNull(
        getItemWithName(indexDocument, IndexDocumentItemPath.from("a_b_c"), IndexValueType.NUMBER));
    assertNotNull(
        getItemWithName(
            indexDocument, IndexDocumentItemPath.from("a_b_d"), IndexValueType.DATETIME));
  }