Module Hub Beta

FT.SEARCH

index query [NOCONTENT] [LIMIT offset num]

Search the index with a textual query, returning either documents or just ids.

Parameters:

  • index: The Fulltext index name. The index must be first created with FT.CREATE
  • query: the text query to search. If it’s more than a single word, put it in quotes.
    Basic syntax like quotes for exact matching is supported.
  • NOCONTENT: If it appears after the query, we only return the document ids and not
    the content. This is useful if redisearch is only an index on an external document collection
  • LIMIT fist num: If the parameters appear after the query, we limit the results to
    the offset and number of results given. The default is 0 10

Return Value

Array reply: A list where the first element is the number of total results, regardless of paging, followed by each document’s id, and a nested list of the document’s fields.

If NOCONTENT is specified, the list just contains the total number of results, and document ids.

Examples

redis> FT.SEARCH idx “hello world” LIMIT 0 1
1) (integer) 5
2) “Hello_Cruel_World”
3) 1) “body”
2) “Hello Cruel World may refer to:”
3) “url”
4) “https://en.wikipedia.org/wiki/Hello_Cruel_World”
5) “title”
6) “Hello Cruel World”
redis> FT.SEARCH idx{0} “hello world” LIMIT 0 1 NOCONTENT
1) (integer) 5
2) “Hello_Cruel_World”

© 2017 Redis Labs, Inc. All rights reserved.