use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterAlsoFiltersOnTheBackupPropertyFieldIfTheVertexDoesContainTheProperty.
@Test
public void filterAlsoFiltersOnTheBackupPropertyFieldIfTheVertexDoesContainTheProperty() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(BACKUP_PROPERTY, "value1")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, "value2")).withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, "value").withProperty(BACKUP_PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value1");
FullTextSearchDescription instance = createLocalFullTextSearchDescriptionWithBackupProperty(NAME, PROPERTY, BACKUP_PROPERTY);
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v3")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterFiltersCaseIndependent.
@Test
public void filterFiltersCaseIndependent() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(PROPERTY, "Value")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, "VALUE")).withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, "vALUE")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value");
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v2"), likeVertex().withTimId("v3")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterIncludesTheVerticesWhereTheSearchedValueIsPartOfThePropertyValueOfTheVertex.
@Test
public void filterIncludesTheVerticesWhereTheSearchedValueIsPartOfThePropertyValueOfTheVertex() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(PROPERTY, "value12344324")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, "another value")).withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value");
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v2"), likeVertex().withTimId("v3")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterFiltersOnABackupFieldIfTheAVertexDoesNotContainThePropertyField.
@Test
public void filterFiltersOnABackupFieldIfTheAVertexDoesNotContainThePropertyField() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(PROPERTY, "value1")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, "value2")).withVertex(vertex -> vertex.withTimId("v3").withProperty(BACKUP_PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value1");
FullTextSearchDescription instance = createLocalFullTextSearchDescriptionWithBackupProperty(NAME, PROPERTY, BACKUP_PROPERTY);
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v3")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterFindsTheVertexViaTheBackupPropertyWhenThePropertyDoesNotMatch.
@Test
public void filterFindsTheVertexViaTheBackupPropertyWhenThePropertyDoesNotMatch() {
// In the real world, the backup property was never reached due to the .coalesce step being
// satisfied that the PersonNames' empty list mapped to a blank string.
// A .union step for both however is quite satisfactory because when a user searches, the user wants
// to search in all available data.
// This test fails when using .coalesce
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, // empty string like in the real world scenario
"").withProperty(BACKUP_PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value1");
FullTextSearchDescription instance = createLocalFullTextSearchDescriptionWithBackupProperty(NAME, PROPERTY, BACKUP_PROPERTY);
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), contains(likeVertex().withTimId("v3")));
}
Aggregations