Skip to content

Commit

Permalink
Added allOptional support for removeWordsIfNoResult query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
speedblue committed Feb 18, 2015
1 parent 20f65cd commit 77d2f54
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ index.saveObject(new JSONObject()
.put("city", "New York"), "myID");
```

You have three ways to update an attribute of an object:

1. Set the attribute value
2. Add an element to an array
3. Remove an element to an array
4. Add an element to an array if it doesn't exist
5. increment an attribute
6. decrement an attribute

Example to update only the city attribute of an existing object:

```java
Expand Down Expand Up @@ -311,6 +320,7 @@ You can use the following optional arguments:
* **removeWordsIfNoResults**: This option to select a strategy to avoid having an empty result page. There is three different option:
* **REMOVE_LAST_WORDS**: when a query does not return any result, the last word will be added as optional (the process is repeated with n-1 word, n-2 word, ... until there is results),
* **REMOVE_FIRST_WORDS**: when a query does not return any result, the first word will be added as optional (the process is repeated with second word, third word, ... until there is results),
* **REMOVE_ALL_OPTIONAL**: When a query does not return any result, a second trial will be made with all words as optional (which is equivalent to transforming the AND operand between query terms in a OR operand)
* **REMOVE_NONE**: No specific processing is done when a query does not return any result (default behavior).
* **setMinWordSizeToAllowOneTypo**: the minimum number of characters in a query word to accept one typo in this word.<br/>Defaults to 4.
* **setMinWordSizeToAllowTwoTypos**: the minimum number of characters in a query word to accept two typos in this word.<br/>Defaults to 8.
Expand Down Expand Up @@ -448,9 +458,6 @@ System.out.println(res.getJSONArray("results").toString())






Get an object
-------------

Expand All @@ -469,6 +476,10 @@ You can also retrieve a set of objects:
index.getObjects(Arrays.asList("myObj1", "myObj2"));
```





Delete an object
-------------

Expand Down

0 comments on commit 77d2f54

Please sign in to comment.