use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.FullTextSearchParameter in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterFiltersTheVerticesOnTheValueOfTheProperty.
@Test
public void filterFiltersTheVerticesOnTheValueOfTheProperty() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(PROPERTY, "value1")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, "number2")).withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter searchParameter = new FullTextSearchParameter(NAME, "value1");
instance.filter(traversal, searchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v3")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.FullTextSearchParameter in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterFiltersAllTheVerticesFromTheTraversalWhenNoneMatch.
@Test
public void filterFiltersAllTheVerticesFromTheTraversalWhenNoneMatch() {
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(PROPERTY, "value").withProperty(BACKUP_PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "Not matching");
FullTextSearchDescription instance = createLocalFullTextSearchDescriptionWithBackupProperty(NAME, PROPERTY, BACKUP_PROPERTY);
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), is(empty()));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.FullTextSearchParameter in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterFiltersOnEachOfTheTermIndividuallyEachPropertyHasToContainOnlyOne.
@Test
public void filterFiltersOnEachOfTheTermIndividuallyEachPropertyHasToContainOnlyOne() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(PROPERTY, "value 12344324 value2")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, "value value2")).withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, "value1 value2")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value value2");
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v2"), likeVertex().withTimId("v3")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.FullTextSearchParameter 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 nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.FullTextSearchParameter 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")));
}
Aggregations