-
Notifications
You must be signed in to change notification settings - Fork 46
Description
NRedisStack Version: 0.13.0
Redis Stack Version: 2.8.16
Description: We got an 'Index was outside the bounds of the array' exception at NRedisStack.Search.Document.Load. This happend while we searched Redis with a query through SearchCommandsAsync.SearchAsync(string indexName, Query q)
.
I can test the static function NRedisStack.Search.Document.Load
and will get this exception every time the parameter RedisValue[]? fields
contains an uneven count of items.
So first I thought this would be a flaw in your code. But then I wrote a test that mimics the situation where the exception occurred and I'm not able to reproduce this exception.
What I see is that your code depends on what comes out of await _db.ExecuteAsync(SearchCommandBuilder.Search(indexName, q))
in your SearchCommandsAsync
function:
public async Task<SearchResult> SearchAsync(string indexName, Query q)
{
if (q.dialect == null && defaultDialect != null)
{
q.Dialect((int)defaultDialect);
}
return (await _db.ExecuteAsync(SearchCommandBuilder.Search(indexName, q))).ToSearchResult(q);
}
My questions:
- Have you ever experienced/heard about that the
RedisResult
object was shaped so that your code through an exception? - Can you think of a cause of this?
- Do you consider to change your code that it could handle the situation without an exception?
kind regards
Swen