1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

fix #2364 - fix FT.SEARCH RETURN [] (#2366)

* fix #2364 - fix FT.SEARCH RETURN []

* remove console.log
This commit is contained in:
Leibale Eidelman
2023-01-18 12:54:42 -05:00
committed by GitHub
parent aa75ee49c6
commit a1dfa22517
2 changed files with 35 additions and 38 deletions

View File

@@ -236,7 +236,7 @@ describe('SEARCH', () => {
});
describe('client.ft.search', () => {
testUtils.testWithClient('DIALECT 1', async client => {
testUtils.testWithClient('without optional options', async client => {
await Promise.all([
client.ft.create('index', {
field: SchemaFieldTypes.NUMERIC
@@ -245,9 +245,7 @@ describe('SEARCH', () => {
]);
assert.deepEqual(
await client.ft.search('index', '*', {
DIALECT: 1
}),
await client.ft.search('index', '*'),
{
total: 1,
documents: [{
@@ -264,44 +262,23 @@ describe('SEARCH', () => {
);
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithClient('DIALECT 2', async client => {
testUtils.testWithClient('RETURN []', async client => {
await Promise.all([
client.ft.create('index', {
field: SchemaFieldTypes.NUMERIC
}),
client.hSet('1', 'field', '1'),
client.hSet('2', 'field', '2'),
client.hSet('3', 'field', '3')
client.hSet('1', 'field', '1')
]);
assert.deepEqual(
await client.ft.search('index', '@field:[$min $max]', {
PARAMS: {
min: 1,
max: 2
},
DIALECT: 2
await client.ft.search('index', '*', {
RETURN: []
}),
{
total: 2,
total: 1,
documents: [{
id: '1',
value: Object.create(null, {
field: {
value: '1',
configurable: true,
enumerable: true
}
})
}, {
id: '2',
value: Object.create(null, {
field: {
value: '2',
configurable: true,
enumerable: true
}
})
value: Object.create(null)
}]
}
);