You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
while testing Redis.OM library we bumped into the problem with internal logic of SearchResponse.
Adding WithScores query flag to SearchAsync causes internal dictionary to try break if two documents have the same score. var query = new RedisQuery("companies"); query.QueryText = ($"(@LastName:%{lastName}%)|(@FirstName:%{firstName}%)|(@Aliases:%{aliases}%)"); query.Flags = (long)QueryFlags.WithScores; var companies = await _client.Connection.SearchAsync<Company>(query);
An item with the same key has already been added. Key: 38 System.ArgumentException: An item with the same key has already been added. Key: 38 at System.Collections.Generic.Dictionary.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.Generic.Dictionary.Add(TKey key, TValue value) at Redis.OM.Searching.SearchResponse..ctor(RedisReply val) at Redis.OM.RediSearchCommands.SearchAsync[T](IRedisConnection connection, RedisQuery query)
The text was updated successfully, but these errors were encountered:
Hmm interesting, yeah this is using the raw Search API(which admittedly isn't fully tested outside what we do with LINQ expressions), I suspect there's something a bit different about the way the result is formatted coming back from RediSearch that's causing this to break like this - will have to dig into it. Thanks for bringing this to my attention @mitjaahlin
Hi,
while testing Redis.OM library we bumped into the problem with internal logic of SearchResponse.
Adding WithScores query flag to SearchAsync causes internal dictionary to try break if two documents have the same score.
var query = new RedisQuery("companies");
query.QueryText = ($"(@LastName:%{lastName}%)|(@FirstName:%{firstName}%)|(@Aliases:%{aliases}%)");
query.Flags = (long)QueryFlags.WithScores;
var companies = await _client.Connection.SearchAsync<Company>(query);
An item with the same key has already been added. Key: 38
System.ArgumentException: An item with the same key has already been added. Key: 38
at System.Collections.Generic.Dictionary.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary.Add(TKey key, TValue value)
at Redis.OM.Searching.SearchResponse..ctor(RedisReply val)
at Redis.OM.RediSearchCommands.SearchAsync[T](IRedisConnection connection, RedisQuery query)
The text was updated successfully, but these errors were encountered: