本文整理了Java中com.algolia.search.saas.Query.setTagFilters
方法的一些代码示例,展示了Query.setTagFilters
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setTagFilters
方法的具体详情如下:
包路径:com.algolia.search.saas.Query
类名称:Query
方法名:setTagFilters
[英]Filter the query by a set of tags. You can AND tags by separating them by commas. To OR tags, you must add parentheses. For example tag1,(tag2,tag3) means tag1 AND (tag2 OR tag3). At indexing, tags should be added in the _tags attribute of objects (for example {"_tags":["tag1","tag2"]} )
[中]
代码示例来源:origin: algolia/algoliasearch-client-java
/**
* Generate a secured and public API Key from a list of tagFilters and an
* optional user token identifying the current user
*
* @param privateApiKey your private API Key
* @param tagFilters the list of tags applied to the query (used as security)
* @deprecated Use `generateSecuredApiKey(String privateApiKey, Query query)` version
*/
@Deprecated
public String generateSecuredApiKey(String privateApiKey, String tagFilters) throws NoSuchAlgorithmException, InvalidKeyException {
if (!tagFilters.contains("="))
return generateSecuredApiKey(privateApiKey, new Query().setTagFilters(tagFilters), null);
else {
return Base64.encodeBase64String(String.format("%s%s", hmac(privateApiKey, tagFilters), tagFilters).getBytes(Charset.forName("UTF8")));
}
}
代码示例来源:origin: algolia/algoliasearch-client-java
/**
* Generate a secured and public API Key from a list of tagFilters and an
* optional user token identifying the current user
*
* @param privateApiKey your private API Key
* @param tagFilters the list of tags applied to the query (used as security)
* @param userToken an optional token identifying the current user
* @deprecated Use `generateSecuredApiKey(String privateApiKey, Query query, String userToken)` version
*/
@Deprecated
public String generateSecuredApiKey(String privateApiKey, String tagFilters, String userToken) throws NoSuchAlgorithmException, InvalidKeyException, AlgoliaException {
if (!tagFilters.contains("="))
return generateSecuredApiKey(privateApiKey, new Query().setTagFilters(tagFilters), userToken);
else {
if (userToken != null && userToken.length() > 0) {
try {
tagFilters = String.format("%s%s%s", tagFilters, "&userToken=", URLEncoder.encode(userToken, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new AlgoliaException(e.getMessage());
}
}
return Base64.encodeBase64String(String.format("%s%s", hmac(privateApiKey, tagFilters), tagFilters).getBytes(Charset.forName("UTF8")));
}
}
代码示例来源:origin: algolia/algoliasearch-client-android
@Test
public void tagFilters() throws JSONException {
final JSONArray VALUE = new JSONArray("[\"tag1\", [\"tag2\", \"tag3\"]]");
Query query = new Query();
assertNull(query.getTagFilters());
query.setTagFilters(VALUE);
assertEquals(VALUE, query.getTagFilters());
assertEquals("[\"tag1\",[\"tag2\",\"tag3\"]]", query.get("tagFilters"));
assertEquals(query.getTagFilters(), Query.parse(query.build()).getTagFilters());
}
内容来源于网络,如有侵权,请联系作者删除!