2017-10-09 59 views

回答

3

看看Algolia's Filtering Guide,你可以在这里了解过滤的工作原理。

随着Android客户端,您可以使用setFilters方法:

Query query = new Query("foo"); 
query.setFilters("category:coffee"); 

您可以找到client's documentation的更多信息:

/** 
* Filter the query with numeric, facet or/and tag filters. 
* <p> 
* The syntax is a SQL like syntax, you can use the OR and AND keywords. The syntax for the underlying numeric, facet and tag filters is the same than in the other filters: 
* {@code available=1 AND (category:Book OR NOT category:Ebook) AND _tags:public date: 1441745506 TO 1441755506 AND inStock > 0 AND author:"John Doe"} 
* 
* @param filters a string following the given syntax. 
* @return the {@link Query} for chaining. 
*/ 
public @NonNull Query setFilters(String filters) 
+0

谢谢兄弟。 public @NonNull Query setFilters(String filters)这是为了什么目的。以及如何使用OR和AND以及在哪里使用。请帮助我 –

+0

例如,如果你想设置一个类别咖啡和品牌星巴克的过滤器,你会做query.setFilters(“category:coffee AND brand:starbucks”) –

+0

非常感谢。 –