Query does not return exact match


I have a field in my table with text.
When i search for the text, it is considered a sub string and returns all the matches.
I need only the exact match to be return.


ft.search test *

  1. (integer) 1
  2. “Test Dup”
    1. “value”
    2. “dummy”
    3. “test”
    4. “Test Dup”
  3. “Test”
    1. “value”
    2. “dummy1”
    3. “test”
    4. “Test”

When I do “ft.search test @test:Test” I receive both the values and not just the exact “Test”.

I tried with special characters and it did not help.

It does not happen with all types. For example, if the values are "Test’ and “Test1”, it returns the exact match. It fails only when there is space.

I tried nostem also. The document is created with redis java.


Have you tried with a TAG in the schema for the field where you want to do an exact match.

For example


FT.ADD idx2 doc1 1.0 FIELDS "value" "dummy" "test" "Test Dup"

FT.ADD idx2 doc2 1.0 FIELDS "value" "dummy1" "test" "Test"

Then when you do the search (query syntax):

>> FT.SEARCH idx2 "@test:{test}" LIMIT 0 10
1) (integer) 1
2) "doc2"
3) 1) "value"
   2) "dummy1"
   3) "test"
   4) "Test"


In the set of documents on which I’m testing RS2 (2.0.5 - ) I’m getting an unexpected behavior. Running on an exact phrase search in just one textual field, wrapped in quotes.

In the sample there are exactly 5 documents containing the textual word tok1 tok2, perfectly in sequence and preceded and followed by others. No document contains the inverse sequence tok2 tok1.

Running the following commands, I get the respective number of results:

  1. FT.SEARCH myindex @textfield:"tok2 tok1" – 5 Results,
  2. FT.SEARCH myindex '@textfield:"tok2 tok1"' – 1 Result

From the premise that there is no document containing the sequence tok2 tok1, I should receive no result.

The textual field in question is of type NOSTEM, and tok1 e tok2 are very differents.

Commands are sent via redis-cli.

This problem occurs sporadically only for certain combinations of tokens. It also occurs with earlier versions of RS, all the way back to 1.6.14, the version I stopped at when running the test.

Try: ft.search test "@test:“Test” "

→ if you want an exact match you have to put your expression: “expression” → see documentation.

it erased the \ in front of the Test → “Test”

hmm: I meant \“Test\”