Skip to content

FT.SEARCH Query syntax error with ? #4999

Open
@finalgamer

Description

@finalgamer

Describe the bug
When a tag field match contains a ? there is always a ERR Query syntax error response.

This seems to currently make it impossible to query a tag field that contains a ?

To Reproduce
Steps to reproduce the behavior:

// 1. Setup the index
FT.CREATE demo_idx ON HASH PREFIX 1 doc: SCHEMA tags TAG 

// 2. Add some documents (optional)
HSET doc:1 name "First Item" tags "?first"
HSET doc:2 name "Second Item" tags "?second"
HSET doc:3 name "Third Item" tags "?third"

// 3. Execute the query
FT.SEARCH demo_idx "@tags:{\\\?second}" // ERR Query syntax error
FT.SEARCH demo_idx "@tags:{\\?second}" // ERR Query syntax error
FT.SEARCH demo_idx "@tags:{\?second}" // ERR Query syntax error
FT.SEARCH demo_idx "@tags:{?second}" // ERR Query syntax error

Expected behavior

The query should not result in an error at least when the ? is properly escaped with \\?

FT.SEARCH demo_idx "@tags:{\\\?second}" // Returns result on redis-search
FT.SEARCH demo_idx "@tags:{\\?second}" // Returns result on redis-search
FT.SEARCH demo_idx "@tags:{\?second}" // Returns empty result on redis-search
FT.SEARCH demo_idx "@tags:{?second}" // Returns empty result on redis-search

Environment (please complete the following information):

  • OS: Ubuntu 22.04.5 LTS
  • Kernel: 5.15.167.4-microsoft-standard-WSL2
  • Containerized?: yes Docker
    docker run -p 6667:6379 docker.dragonflydb.io/dragonflydb/dragonfly:v1.29.0
  • Dragonfly Version: 1.29.0

Reproducible Code Snippet

See above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions