use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.SearchRequestV2_1 in project timbuctoo by HuygensING.
the class ListFacetDescriptionTest method filterAddsNoFilterIfTheFacetValueIsNotAListFacetValue.
@Test
public void filterAddsNoFilterIfTheFacetValueIsNotAListFacetValue() {
String value1 = "value1";
List<FacetValue> facetValues = Lists.newArrayList((FacetValue) () -> FACET_NAME);
SearchRequestV2_1 searchRequest = new SearchRequestV2_1();
searchRequest.setFacetValues(facetValues);
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withProperty(PROPERTY, value1).withTimId("1")).withVertex(v -> v.withProperty(PROPERTY, "value2").withTimId("2")).build().traversal().V();
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), containsInAnyOrder(VertexMatcher.likeVertex().withTimId("1"), VertexMatcher.likeVertex().withTimId("2")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.SearchRequestV2_1 in project timbuctoo by HuygensING.
the class ListFacetDescriptionTest method filterAddsNoFilterIfTheFacetValuesIsEmpty.
@Test
public void filterAddsNoFilterIfTheFacetValuesIsEmpty() {
String value1 = "value1";
List<FacetValue> facetValues = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList()));
SearchRequestV2_1 searchRequest = new SearchRequestV2_1();
searchRequest.setFacetValues(facetValues);
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withProperty(PROPERTY, value1).withTimId("1")).withVertex(v -> v.withProperty(PROPERTY, "value2").withTimId("2")).build().traversal().V();
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), containsInAnyOrder(VertexMatcher.likeVertex().withTimId("1"), VertexMatcher.likeVertex().withTimId("2")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.SearchRequestV2_1 in project timbuctoo by HuygensING.
the class EdgeListFacetDescriptionTest method filterAddsNoFilterIfTheFacetValuesIsEmpty.
@Test
public void filterAddsNoFilterIfTheFacetValuesIsEmpty() {
List<FacetValue> facetValues = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList()));
SearchRequestV2_1 searchRequest = new SearchRequestV2_1();
searchRequest.setFacetValues(facetValues);
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("1")).withVertex(v -> v.withTimId("2")).build().traversal().V();
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), containsInAnyOrder(VertexMatcher.likeVertex().withTimId("1"), VertexMatcher.likeVertex().withTimId("2")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.SearchRequestV2_1 in project timbuctoo by HuygensING.
the class EdgeListFacetDescriptionTest method filterAddsAFilterToFilterOutTheNonMatchingVertices.
@Test
public void filterAddsAFilterToFilterOutTheNonMatchingVertices() {
List<FacetValue> facetValues = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList(RELATION_NAME)));
SearchRequestV2_1 searchRequest = new SearchRequestV2_1();
searchRequest.setFacetValues(facetValues);
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex("v1", v -> v.withTimId("1")).withVertex("v2", v -> v.withTimId("2").withOutgoingRelation(RELATION_NAME, "v1")).build().traversal().V();
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), contains(VertexMatcher.likeVertex().withTimId("1")));
}
use of nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.SearchRequestV2_1 in project timbuctoo by HuygensING.
the class ListFacetDescriptionTest method filterAddsAFilterToFilterOutTheNonMatchingVertices.
@Test
public void filterAddsAFilterToFilterOutTheNonMatchingVertices() {
String value1 = "value1";
List<FacetValue> facetValues = Lists.newArrayList(new ListFacetValue(FACET_NAME, Lists.newArrayList(value1)));
SearchRequestV2_1 searchRequest = new SearchRequestV2_1();
searchRequest.setFacetValues(facetValues);
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withProperty(PROPERTY, value1).withTimId("1")).withVertex(v -> v.withProperty(PROPERTY, "value2").withTimId("2")).build().traversal().V();
instance.filter(traversal, facetValues);
assertThat(traversal.toList(), contains(VertexMatcher.likeVertex().withTimId("1")));
}
Aggregations