redis / node-redis

Redis Node.js client
https://redis.js.org/
MIT License
16.84k stars 1.87k forks source link

Add RediSearch Dialect Version Configuration Option #2520

Open uglide opened 1 year ago

uglide commented 1 year ago

In the current implementation of the client, users are required to specify the RediSearch dialect version for every FT.SEARCH or FT.AGGREGATE command. This repetitive configuration process might be prone to errors and can lead to inconsistency issues across different parts of a project where different dialect versions might be unintentionally used.

In order to make our client more user-friendly and maintain consistency throughout the usage, we need to provide a configuration option that allows users to set the RediSearch dialect version at the connection level. This will ensure the specified version is used across all FT.SEARCH and FT.AGGREGATE commands, removing the need to set it individually each time.

Acceptance Criteria:

leibale commented 1 year ago
  1. This should be a server-side feature (config for default dialect).
  2. If you want to make sure you are using the same dialect across all FT.SEARCH you can create a "wrapper function":
    function search(idx, query, options) {
    options ??= {};
    options.DIALECT ??= DEFAULT_DIALECT;
    return client.ft.search(idx, query, options);
    }
uglide commented 1 year ago

@leibale At the moment, there is no support for it on server side in the cloud. That's why adding it on the client side is easier as a first step.

uglide commented 1 year ago

@leibale btw, we need it for multiple commands and it's not developer-friendly to have 6 wrappers around FT.SEARCH, FT.AGGREGATE, FT.EXPLAIN, FT.EXPLAINCLI, and FT.SPELLCHECK commands to set dialect version.