RediSearch / redisearch-go

Go client for RediSearch
https://redisearch.io
BSD 3-Clause "New" or "Revised" License
293 stars 65 forks source link

Dev num filter closed interval #139

Closed ZMbiubiubiu closed 2 years ago

ZMbiubiubiu commented 2 years ago

When I use num filter with open interval, for example (1,49]

query := redisearch.NewQuery("*").AddFilter(
    redisearch.Filter{
        Field: "uid",
        Options: redisearch.NumericFilterOptions{
            Min:          1,
            ExclusiveMin: true,
            Max:          49,
            ExclusiveMax: false,
        },
    },
)

But I meet this error

total: 0, err:Unknown argument 49 at position 5 for

Then I debugged it,So I find the final command sent to redis server is

*8
$9
FT.SEARCH
$4
tags
$1
*
$6
FILTER
$3
uid
$1
(
$1
1
$2
49

So I think the error is here

$1
(
$1
1

This means that ( 1

So I typed in the command line

ft.search tags * filter uid ( 1 49

I meet the same problem

Unknown argument 49 at position 5 for

But if I take ( and 1 togather

ft.search tags * filter uid (1 49

Oh,It's ok.

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

ZMbiubiubiu commented 2 years ago

@gkorland

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

codecov[bot] commented 2 years ago

Codecov Report

Merging #139 (33405f3) into master (136e040) will increase coverage by 0.13%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #139      +/-   ##
==========================================
+ Coverage   76.18%   76.32%   +0.13%     
==========================================
  Files          13       13              
  Lines        1432     1432              
==========================================
+ Hits         1091     1093       +2     
+ Misses        275      274       -1     
+ Partials       66       65       -1     
Impacted Files Coverage Δ
redisearch/query.go 87.37% <100.00%> (ø)
redisearch/client.go 74.08% <0.00%> (+0.45%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 136e040...33405f3. Read the comment docs.