We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
hello, i don't know why but exact match and params dont seems to works together.
import { createClient, SchemaFieldTypes } from 'redis'; import { GenericContainer } from 'testcontainers'; (async () => { const redisClient = await new GenericContainer( 'redis/redis-stack-server:7.2.0-RC1-arm64' ) .withExposedPorts(6379) .start() .then((container) => { const client = createClient({ url: `redis://${container.getHost()}:${container.getMappedPort(6379)}` }); client.on('end', async () => await container.stop()); client.on('error', (err) => console.log('Redis Client Error', err)); return client.connect().then(() => client); }); await redisClient.json.set(`noderedis:users:0`, '$', { name: 'Alice Johnson', age: 32, coins: 100 }); await redisClient.ft.create('idx:users', { '$.name': { type: SchemaFieldTypes.TEXT, SORTABLE: 'UNF', AS: 'name' }, '$.age': { type: SchemaFieldTypes.NUMERIC, AS: 'age' }, '$.coins': { type: SchemaFieldTypes.NUMERIC, AS: 'coins' } }, { ON: 'JSON', PREFIX: 'noderedis:users' }); console.log({ // ✅ works: 1 result bare: await redisClient.ft.search('idx:users', '@name:"Alice Johnson"', { DIALECT: 2 }), // ✅ works: 1 result withParamsNumber: await redisClient.ft.search('idx:users', '@age:[$age $age]', { DIALECT: 2, PARAMS: { age: 32 } }), // ❌ no results withParamsExactMatch1: await redisClient.ft.search('idx:users', '@name:"$name"', { DIALECT: 2, PARAMS: { name: 'Alice Johnson' } }), // ❌ no results withParamsExactMatch2: await redisClient.ft.search('idx:users', '@name:$name', { DIALECT: 2, PARAMS: { name: '"Alice Johnson"' } }), // ✅ works: 1 result withParamsMatch: await redisClient.ft.search('idx:users', '@name:($name)', { DIALECT: 2, PARAMS: { name: 'Alice' } }), }) await redisClient.disconnect(); })();
No response
The text was updated successfully, but these errors were encountered:
i just found an interesting clue:
while
redisClient.ft.search('idx:users', '@name:"$name"', { DIALECT: 2, PARAMS: { name: 'Alice Johnson' } })
does not work.
redisClient.ft.search('idx:users', '@name:"$name1 $name2"', { DIALECT: 2, PARAMS: { name1: 'Alice', name2: 'Johnson' } })
works.
same thing for other type of match:
redisClient.ft.search('idx:users', '@name:($name)', { DIALECT: 2, PARAMS: { name: 'Alice Johnson' } })
redisClient.ft.search('idx:users', '@name:($name1 $name2)', { DIALECT: 2, PARAMS: { name1: 'Alice', name2: 'Johnson' } })
Sorry, something went wrong.
No branches or pull requests
Description
hello, i don't know why but exact match and params dont seems to works together.
Reproduction
Node.js Version
No response
Redis Server Version
No response
Node Redis Version
No response
Platform
No response
Logs
The text was updated successfully, but these errors were encountered: