本文整理了Java中com.algolia.search.saas.Query.get
方法的一些代码示例,展示了Query.get
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.get
方法的具体详情如下:
包路径:com.algolia.search.saas.Query
类名称:Query
方法名:get
暂无
代码示例来源:origin: algolia/algoliasearch-client-android
/**
* Get the numeric, facet or/and tag filters for this Query.
*
* @return a String with this query's filters.
*/
public @Nullable
String getFilters() {
return get(KEY_FILTERS);
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void minWordSizefor1Typo() {
Query query = new Query();
assertNull(query.getMinWordSizefor1Typo());
query.setMinWordSizefor1Typo(123);
assertEquals(Integer.valueOf(123), query.getMinWordSizefor1Typo());
assertEquals("123", query.get("minWordSizefor1Typo"));
assertEquals(query.getMinWordSizefor1Typo(), Query.parse(query.build()).getMinWordSizefor1Typo());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void maxValuesPerFacet() {
Query query = new Query();
assertNull(query.getMaxValuesPerFacet());
query.setMaxValuesPerFacet(456);
assertEquals(Integer.valueOf(456), query.getMaxValuesPerFacet());
assertEquals("456", query.get("maxValuesPerFacet"));
assertEquals(query.getMaxValuesPerFacet(), Query.parse(query.build()).getMaxValuesPerFacet());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void query() {
Query query = new Query();
assertNull(query.getQuery());
query.setQuery("supercalifragilisticexpialidocious");
assertEquals("supercalifragilisticexpialidocious", query.getQuery());
assertEquals("supercalifragilisticexpialidocious", query.get("query"));
assertEquals(query.getQuery(), Query.parse(query.build()).getQuery());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void hitsPerPage() {
Query query = new Query();
assertNull(query.getHitsPerPage());
query.setHitsPerPage(50);
assertEquals(Integer.valueOf(50), query.getHitsPerPage());
assertEquals("50", query.get("hitsPerPage"));
assertEquals(query.getHitsPerPage(), Query.parse(query.build()).getHitsPerPage());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void facetFilters() throws JSONException {
final JSONArray VALUE = new JSONArray("[[\"category:Book\", \"category:Movie\"], \"author:John Doe\"]");
Query query = new Query();
assertNull(query.getFacetFilters());
query.setFacetFilters(VALUE);
assertEquals(VALUE, query.getFacetFilters());
assertEquals("[[\"category:Book\",\"category:Movie\"],\"author:John Doe\"]", query.get("facetFilters"));
assertEquals(query.getFacetFilters(), Query.parse(query.build()).getFacetFilters());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void highlightPreTag() {
Query query = new Query();
assertNull(query.getHighlightPreTag());
query.setHighlightPreTag("<PRE[");
assertEquals("<PRE[", query.getHighlightPreTag());
assertEquals("<PRE[", query.get("highlightPreTag"));
assertEquals(query.getHighlightPreTag(), Query.parse(query.build()).getHighlightPreTag());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void numericFilters() throws JSONException {
final JSONArray VALUE = new JSONArray("[\"code=1\", [\"price:0 to 10\", \"price:1000 to 2000\"]]");
Query query = new Query();
assertNull(query.getNumericFilters());
query.setNumericFilters(VALUE);
assertEquals(VALUE, query.getNumericFilters());
assertEquals("[\"code=1\",[\"price:0 to 10\",\"price:1000 to 2000\"]]", query.get("numericFilters"));
assertEquals(query.getNumericFilters(), Query.parse(query.build()).getNumericFilters());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void attributesToSnippet() {
Query query = new Query();
assertNull(query.getAttributesToSnippet());
query.setAttributesToSnippet("foo:3", "bar:7");
assertArrayEquals(new String[]{"foo:3", "bar:7"}, query.getAttributesToSnippet());
assertEquals("[\"foo:3\",\"bar:7\"]", query.get("attributesToSnippet"));
assertArrayEquals(query.getAttributesToSnippet(), Query.parse(query.build()).getAttributesToSnippet());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void snippetEllipsisText() {
Query query = new Query();
assertNull(query.getSnippetEllipsisText());
query.setSnippetEllipsisText("…");
assertEquals("…", query.getSnippetEllipsisText());
assertEquals("…", query.get("snippetEllipsisText"));
Query query2 = Query.parse(query.build());
assertEquals(query.getSnippetEllipsisText(), query2.getSnippetEllipsisText());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void filters() {
final String VALUE = "available=1 AND (category:Book OR NOT category:Ebook) AND publication_date: 1441745506 TO 1441755506 AND inStock > 0 AND author:\"John Doe\"";
Query query = new Query();
assertNull(query.getFilters());
query.setFilters(VALUE);
assertEquals(VALUE, query.getFilters());
assertEquals(VALUE, query.get("filters"));
assertEquals(query.getFilters(), Query.parse(query.build()).getFilters());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void ruleContexts() {
Query query = new Query();
assertNull(query.getRuleContexts());
query.setRuleContexts("foo", "bar");
assertArrayEquals(new String[]{"foo", "bar"}, query.getRuleContexts());
assertEquals("[\"foo\",\"bar\"]", query.get("ruleContexts"));
assertArrayEquals(query.getRuleContexts(), Query.parse(query.build()).getRuleContexts());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void aroundRadius() {
Query query = new Query();
assertNull(query.getAroundRadius());
query.setAroundRadius(987);
assertEquals(Integer.valueOf(987), query.getAroundRadius());
assertEquals("987", query.get("aroundRadius"));
Query query2 = Query.parse(query.build());
assertEquals(query.getAroundRadius(), query2.getAroundRadius());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void optionalWords() {
Query query = new Query();
assertNull(query.getOptionalWords());
query.setOptionalWords("foo", "bar");
assertArrayEquals(new String[]{"foo", "bar"}, query.getOptionalWords());
assertEquals("[\"foo\",\"bar\"]", query.get("optionalWords"));
assertArrayEquals(query.getOptionalWords(), Query.parse(query.build()).getOptionalWords());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void optionalFilters() {
Query query = new Query();
assertNull(query.getOptionalFilters());
query.setOptionalFilters("foo", "bar");
assertArrayEquals(new String[]{"foo", "bar"}, query.getOptionalFilters());
assertEquals("[\"foo\",\"bar\"]", query.get("optionalFilters"));
assertArrayEquals(query.getOptionalFilters(), Query.parse(query.build()).getOptionalFilters());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void restrictSearchableAttributes() {
Query query = new Query();
assertNull(query.getRestrictSearchableAttributes());
query.setRestrictSearchableAttributes("foo", "bar");
assertArrayEquals(new String[]{"foo", "bar"}, query.getRestrictSearchableAttributes());
assertEquals("[\"foo\",\"bar\"]", query.get("restrictSearchableAttributes"));
assertArrayEquals(query.getRestrictSearchableAttributes(), Query.parse(query.build()).getRestrictSearchableAttributes());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void removeStopWordsBoolean() throws Exception {
Query query = new Query();
assertNull(query.getRemoveStopWords());
query.setRemoveStopWords(true);
assertEquals(Boolean.TRUE, query.getRemoveStopWords());
assertEquals("true", query.get("removeStopWords"));
assertEquals(query.getRemoveStopWords(), Query.parse(query.build()).getRemoveStopWords());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void exactOnSingleWordQuery() {
Query.ExactOnSingleWordQuery VALUE = Query.ExactOnSingleWordQuery.ATTRIBUTE;
Query query = new Query();
assertNull(query.getExactOnSingleWordQuery());
query.setExactOnSingleWordQuery(VALUE);
assertEquals(VALUE, query.getExactOnSingleWordQuery());
assertEquals("attribute", query.get("exactOnSingleWordQuery"));
assertEquals(query.getExactOnSingleWordQuery(), Query.parse(query.build()).getExactOnSingleWordQuery());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void disableExactOnAttributes() {
Query query = new Query();
assertNull(query.getDisableExactOnAttributes());
query.setDisableExactOnAttributes("foo", "bar");
assertArrayEquals(new String[]{"foo", "bar"}, query.getDisableExactOnAttributes());
assertEquals("[\"foo\",\"bar\"]", query.get("disableExactOnAttributes"));
Query query2 = Query.parse(query.build());
assertArrayEquals(query.getDisableExactOnAttributes(), query2.getDisableExactOnAttributes());
}
代码示例来源:origin: algolia/algoliasearch-client-android
public @Nullable
JSONArray getTagFilters() {
try {
String value = get(KEY_TAG_FILTERS);
if (value != null) {
return new JSONArray(value);
}
} catch (JSONException e) {
// Will return null
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!