As described earlier in the tutorial, one of the goals of RediSearch is to provide rich querying capabilities such as:
- simple and complex conditions
The best way to start to work with RediSearch query capabilities is to look at the various conditions options.
The first line contains the number of documents (
4) that match the query condition, then the list of movies.
This query is a "fieldless" condition, this means that the query engine has:
- searched in all the TEXT fields of the index(
- for the word
heatand related words, this is why the movie:736 is returned since it has the word
heatedin the plot (stemming)
- returned the result sorted by score, remember that the title has a weight of 1.0, and the plot a weight of 0.5. So when the word or related words are found in the title the score is larger.
In this case you have to set the criteria to a the field title using the
So only 2 movies are returned.
For this you add parentheses around the field condition and add the
- sign to 'california'.
Only one movie is returned.
If you do not put the
( .. ) the
-california condition will be applied to all the text fields.
You can do test this with the following queries:
As you can see the first query only searches for woman in the title and returns two movies "Heat" and "California Heat", where the second query eliminates "California Heat" from the list since the plot contains the word