com.algolia.search.saas.Query.getFacets()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中com.algolia.search.saas.Query.getFacets方法的一些代码示例,展示了Query.getFacets的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getFacets方法的具体详情如下:
包路径:com.algolia.search.saas.Query
类名称:Query
方法名:getFacets

Query.getFacets介绍

暂无

代码示例

代码示例来源:origin: algolia/algoliasearch-client-android

@Test
public void facets() {
  Query query = new Query();
  assertNull(query.getFacets());
  query.setFacets("foo", "bar");
  assertArrayEquals(new String[]{"foo", "bar"}, query.getFacets());
  assertEquals("[\"foo\",\"bar\"]", query.get("facets"));
  Query query2 = Query.parse(query.build());
  assertArrayEquals(query.getFacets(), query2.getFacets());
}

代码示例来源:origin: algolia/instantsearch-android

String[] facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should contain one facet.", 1, facets.length);
Assert.assertEquals("The query's facet should be `foo`.", "foo", facets[0]);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should still contain one facet.", 1, facets.length);
Assert.assertEquals("The query's facet should still be `foo`.", "foo", facets[0]);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should still contain one facet.", 1, facets.length);
Assert.assertEquals("The query's facet should still be `foo`.", "foo", facets[0]);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should contain two facets.", 2, facets.length);
Assert.assertEquals("The query's second facet should be `bar`.", "bar", facets[1]);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should now contain one facet.", 1, facets.length);
Assert.assertEquals("The query's facet should now be `bar`.", "bar", facets[0]);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should now contain three facets.", 3, facets.length);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should now contain no facets.", 0, facets.length);
facets = searcher.getQuery().getFacets();
Assert.assertEquals("The query should now contain no facets.", 0, facets.length);

相关文章