Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRedisearch issue with the search for "bond" #3

Open
elan-echambon opened this issue Nov 17, 2020 · 3 comments
Open

NRedisearch issue with the search for "bond" #3

elan-echambon opened this issue Nov 17, 2020 · 3 comments

Comments

@elan-echambon
Copy link

Hi,

I see a very weird behaviour with the C# client when creating a suggestion and then looking for it. Here is the code :

// Creating the client
var client = new NRediSearch.Client("redisearch:error", /* IDatabase */);

// Adding the suggestion
var nameBuilder = new Suggestion.SuggestionBuilder();
nameBuilder.String("bond");
nameBuilder.Score(0.5);
nameBuilder.Payload("test");
client.AddSuggestion(nameBuilder.Build());

// Querying it
var optionsBuilder = new SuggestionOptions.SuggestionOptionsBuilder();
optionsBuilder.With(SuggestionOptions.WithOptions.PayloadsAndScores);
optionsBuilder.Max(10);
optionsBuilder.Fuzzy();
var suggestionsOptions = optionsBuilder.Build();
var res = client.GetSuggestions("bond", suggestionsOptions);

Am i missing something obvious or is it a bug ? Also if you replace "bond" by something else, it does work sometimes and sometimes doesn't.

Thanks

StackTrace:
StackExchange.Redis.RedisCommandException: Missing required fields: score not within range: 2147483648
at NRediSearch.Suggestion.SuggestionBuilder.Build() in //src/NRediSearch/Suggestion.cs:line 102
at NRediSearch.Client.GetSuggestionsWithPayloadAndScores(RedisResult[] results) in /
/src/NRediSearch/Client.cs:line 1271
at NRediSearch.Client.GetSuggestions(String prefix, SuggestionOptions options) in /_/src/NRediSearch/Client.cs:line 813
at Cobra.Timeseries.TestClient.RedisSearchError.Run() in C:\repositories\cobra\Cobra\Cobra.Timeseries.TestClient\RedisSearchError.cs:line 30

@elan-echambon elan-echambon changed the title NRedissearch issue with the search for "bond" NRedisearch issue with the search for "bond" Nov 17, 2020
@mgravell
Copy link
Collaborator

mgravell commented Nov 17, 2020

I observed something similar when testing the RediSearch 2 changes (are you using RediSearch 2 by any chance?) - see this fix here. I had been hoping for some feedback from @gkorland on some questions including this topic, but I may have to just give up on that and review for final merge

@elan-echambon
Copy link
Author

Hi Marc,

Thanks a lot for your quick answer. I'm using RediSearch version 2.0.1 (running on Redis 6.0.9) on the server and the C# client is version 2.1.30 (latest available).
Looking at the fix, it does look like it would fix the issue - I'm happy to test this usecase once merged and released.

Thanks

@elan-echambon
Copy link
Author

Hi @mgravell @gkorland , did you have the time to look into this? Would be good to merge if everyone is happy

@NickCraver NickCraver transferred this issue from StackExchange/StackExchange.Redis Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants