本文整理了Java中com.algolia.search.saas.Query.<init>
方法的一些代码示例,展示了Query.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>
方法的具体详情如下:
包路径:com.algolia.search.saas.Query
类名称:Query
方法名:<init>
[英]Construct an empty query.
[中]构造一个空查询。
代码示例来源:origin: algolia/algoliasearch-client-android
/**
* Parse a query object from a URL query parameter string.
*
* @param queryParameters URL query parameter string.
* @return The parsed query object.
*/
protected static @NonNull
Query parse(@NonNull String queryParameters) {
Query query = new Query();
query.parseFrom(queryParameters);
return query;
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void removeStopWordsInvalidClass() throws Exception {
Query query = new Query();
try {
query.setRemoveStopWords(42);
} catch (AlgoliaException ignored) {
return; //pass
}
fail("setRemoveStopWords should throw when its parameter is neither Boolean nor String.");
}
代码示例来源:origin: algolia/algoliasearch-client-android
/**
* Test serializing a query into a URL query string.
*/
@Test
public void build() {
Query query = new Query();
query.set("c", "C");
query.set("b", "B");
query.set("a", "A");
String queryString = query.build();
assertEquals("a=A&b=B&c=C", queryString);
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void minWordSizefor2Typos() {
Query query = new Query();
assertNull(query.getMinWordSizefor2Typos());
query.setMinWordSizefor2Typos(456);
assertEquals(Integer.valueOf(456), query.getMinWordSizefor2Typos());
assertEquals("456", query.get("minWordSizefor2Typos"));
assertEquals(query.getMinWordSizefor2Typos(), Query.parse(query.build()).getMinWordSizefor2Typos());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void aroundPrecision() {
Query query = new Query();
assertNull(query.getAroundPrecision());
query.setAroundPrecision(12345);
assertEquals(Integer.valueOf(12345), query.getAroundPrecision());
assertEquals("12345", query.get("aroundPrecision"));
Query query2 = Query.parse(query.build());
assertEquals(query.getAroundPrecision(), query2.getAroundPrecision());
}
代码示例来源: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 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 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 distinct() {
Query query = new Query();
assertNull(query.getDistinct());
query.setDistinct(100);
assertEquals(Integer.valueOf(100), query.getDistinct());
assertEquals("100", query.get("distinct"));
assertEquals(query.getDistinct(), Query.parse(query.build()).getDistinct());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void length() {
Query query = new Query();
assertNull(query.getLength());
query.setLength(456);
assertEquals(Integer.valueOf(456), query.getLength());
assertEquals("456", query.get("length"));
assertEquals(query.getLength(), Query.parse(query.build()).getLength());
}
代码示例来源: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
@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 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 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 highlightPostTag() {
Query query = new Query();
assertNull(query.getHighlightPostTag());
query.setHighlightPostTag("]POST>");
assertEquals("]POST>", query.getHighlightPostTag());
assertEquals("]POST>", query.get("highlightPostTag"));
assertEquals(query.getHighlightPostTag(), Query.parse(query.build()).getHighlightPostTag());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void disableTypoToleranceOnAttributes() {
Query query = new Query();
assertNull(query.getDisableTypoToleranceOnAttributes());
query.setDisableTypoToleranceOnAttributes("foo", "bar");
assertArrayEquals(new String[]{"foo", "bar"}, query.getDisableTypoToleranceOnAttributes());
assertEquals("[\"foo\",\"bar\"]", query.get("disableTypoToleranceOnAttributes"));
Query query2 = Query.parse(query.build());
assertArrayEquals(query.getDisableTypoToleranceOnAttributes(), query2.getDisableTypoToleranceOnAttributes());
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void removeStopWordsString() throws Exception {
Query query = new Query();
assertNull(query.getRemoveStopWords());
query.setRemoveStopWords("fr,en");
final Object[] removeStopWords = (Object[]) query.getRemoveStopWords();
assertArrayEquals(new String[]{"fr", "en"}, removeStopWords);
assertEquals("fr,en", query.get("removeStopWords"));
assertArrayEquals((Object[]) query.getRemoveStopWords(), (Object[]) Query.parse(query.build()).getRemoveStopWords());
}
内容来源于网络,如有侵权,请联系作者删除!