Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 1bcbd85

Browse files
authored
Deprecate facetFilters in favor of filter (#182)
* Query: Deprecate {set,get}FacetFilters * Query: Document {set,get}Filters [ci skip]
1 parent a4a4f75 commit 1bcbd85

File tree

1 file changed

+23
-0
lines changed
  • algoliasearch/src/main/java/com/algolia/search/saas

1 file changed

+23
-0
lines changed

algoliasearch/src/main/java/com/algolia/search/saas/Query.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,20 @@ public String[] getFacets() {
349349

350350
private static final String KEY_FACET_FILTERS = "facetFilters";
351351

352+
/**
353+
* Set the <b>deprecated</b> {@code facetFilters} parameter.
354+
*
355+
* @deprecated Use {@link Query#setFilters(String)} instead.
356+
*/
352357
public @NonNull Query setFacetFilters(JSONArray filters) {
353358
return set(KEY_FACET_FILTERS, filters);
354359
}
355360

361+
/**
362+
* Get the value of <b>deprecated</b> {@code facetFilters} parameter.
363+
*
364+
* @deprecated Use {@link Query#getFilters()} instead.
365+
*/
356366
public JSONArray getFacetFilters() {
357367
try {
358368
String value = get(KEY_FACET_FILTERS);
@@ -368,10 +378,23 @@ public JSONArray getFacetFilters() {
368378

369379
private static final String KEY_FILTERS = "filters";
370380

381+
/**
382+
* Filter the query with numeric, facet or/and tag filters.
383+
* <p>
384+
* 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:
385+
* {@code available=1 AND (category:Book OR NOT category:Ebook) AND _tags:public date: 1441745506 TO 1441755506 AND inStock > 0 AND author:"John Doe"}
386+
*
387+
* @param filters a string following the given syntax.
388+
* @return the {@link Query} for chaining.
389+
*/
371390
public @NonNull Query setFilters(String filters) {
372391
return set(KEY_FILTERS, filters);
373392
}
374393

394+
/**
395+
* Get the numeric, facet or/and tag filters for this Query.
396+
* @return a String with this query's filters.
397+
*/
375398
public String getFilters() {
376399
return get(KEY_FILTERS);
377400
}

0 commit comments

Comments
 (0)