You can filter search results on the server side by applying a search filter – this is similar to the SQL where clause.
The example below demonstrates how to filter the query to return only results with the extendedPrice between 160 and 350. It also introduces the query Limit method to return only the first 5 results – this is similar to the SELECT TOP clause of SQL.
The query above filters the query to return only results where the extendedPrice is between 160 and 350. In addition to numeric filters, RediSearch also supports GEO filters; this is not covered here. In line 12 we limit the returned records to the first 5. The parameters for the Limit are the 0ffset and number of records – the default is Limit(0,10).
Restricting Search Within Fields
The default behavior of RediSearch is to search all text properties specified in the schema. You can restrict which fields to search as shown in the code fragment below.
RediSearch has several query examples at this link.
Subscribe to Technical Blogs
Get the latest posts delivered right to your inbox
You've successfully subscribed to Technical Blogs!