use of com.yelp.nrtsearch.server.grpc.Facet in project nrtsearch by Yelp.
the class FacetScriptFacetsTest method testNullValue.
@Test
public void testNullValue() {
Facet facet = Facet.newBuilder().setScript(Script.newBuilder().setLang("test_lang").setSource("null").build()).setTopN(10).build();
SearchResponse response = doQuery(facet);
assertEquals(1, response.getFacetResultCount());
FacetResult result = response.getFacetResult(0);
assertEquals(100, result.getValue(), 0);
assertEquals(0, result.getChildCount());
assertEquals(0, result.getLabelValuesCount());
}
use of com.yelp.nrtsearch.server.grpc.Facet in project nrtsearch by Yelp.
the class FacetScriptFacetsTest method testFacetLabelSubset.
@Test
public void testFacetLabelSubset() {
Facet facet = Facet.newBuilder().setScript(Script.newBuilder().setLang("test_lang").setSource("concat").build()).setTopN(4).build();
SearchResponse response = doQuery(facet);
assertResponse(response, 100, 6, 4, new ExpectedValues(new HashSet<>(Arrays.asList("0_0", "0_1", "1_1", "2_0")), 17));
}
use of com.yelp.nrtsearch.server.grpc.Facet in project nrtsearch by Yelp.
the class FacetScriptFacetsTest method testIterableRangeValue.
@Test
public void testIterableRangeValue() {
Facet facet = Facet.newBuilder().setScript(Script.newBuilder().setLang("test_lang").setSource("combine").build()).setTopN(10).build();
SearchResponse response = doRangeQuery(facet);
assertResponse(response, 10, 3, 3, new ExpectedValues(new HashSet<>(Arrays.asList("0", "1")), 6), new ExpectedValues(new HashSet<>(Collections.singletonList("2")), 4));
}
use of com.yelp.nrtsearch.server.grpc.Facet in project nrtsearch by Yelp.
the class FacetScriptFacetsTest method testFacetGreaterN.
@Test
public void testFacetGreaterN() {
Facet facet = Facet.newBuilder().setScript(Script.newBuilder().setLang("test_lang").setSource("concat").build()).setTopN(10).build();
SearchResponse response = doQuery(facet);
assertResponse(response, 100, 6, 6, new ExpectedValues(new HashSet<>(Arrays.asList("0_0", "0_1", "1_1", "2_0")), 17), new ExpectedValues(new HashSet<>(Arrays.asList("1_0", "2_1")), 16));
}
use of com.yelp.nrtsearch.server.grpc.Facet in project nrtsearch by Yelp.
the class FacetScriptFacetsTest method testIterableLabelSubset.
@Test
public void testIterableLabelSubset() {
Facet facet = Facet.newBuilder().setScript(Script.newBuilder().setLang("test_lang").setSource("combine").build()).setTopN(2).build();
SearchResponse response = doQuery(facet);
assertResponse(response, 100, 3, 2, new ExpectedValues(new HashSet<>(Collections.singletonList("0")), 67), new ExpectedValues(new HashSet<>(Collections.singletonList("1")), 66));
}
Aggregations