StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.87k stars 1.51k forks source link

Correct way to set Max Search Results? #2342

Closed JuliusMikkela closed 1 year ago

JuliusMikkela commented 1 year ago

I'm working with a large data set and I have a need to ensure that the max search results is greater than the default 10K, and if possible I'd like this to be done from code. However I can't seem to find an API for setting this value, and my attempts to use FT.CONFIG fails with ArgumentOutOfRangeExceptions.

connectionMultiplexer.GetDatabase().Execute("FT.CONFIG SET maxsearchresults 1000000")

So what is the correct/intended way to set Max Search Results from code?

mgravell commented 1 year ago
connectionMultiplexer.GetDatabase().Execute("FT.CONFIG",  "SET", maxsearchresults, 1000000);

?

JuliusMikkela commented 1 year ago

Ah, so so each part of the query must be its own args. Thank you that worked splendidly.

slorello89 commented 1 year ago

You can use FT.CONFIG like Marc said (if you use the adhoc command you need to separate the arguments or else they will not be serialized correctly), you can also set it with the loadmodule conf option:

loadmodule ./redisearch.so maxsearchresults 1000000

Also if you are using the redis-stack image on docker, you can use the REDISEARCH_ARGS environment variable e.g.

docker run -d -e REDISEARCH_ARGS="MAXSEARCHRESULTS 10000000" -p 6379:6379 redis/redis-stack-server

For a full examination on the topic see the page on Redis io