Skip to content

Commit

Permalink
small tweak for stopWords
Browse files Browse the repository at this point in the history
  • Loading branch information
sjpotter committed Oct 9, 2024
1 parent 16950d0 commit e1b935c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/search/lib/commands/INFO.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import INFO from './INFO';
import INFO, { InfoReply } from './INFO';
import { SCHEMA_FIELD_TYPE } from './CREATE';

describe('INFO', () => {
Expand All @@ -15,8 +15,10 @@ describe('INFO', () => {
await client.ft.create('index', {
field: SCHEMA_FIELD_TYPE.TEXT
});
const ret = await client.ft.info('index');
assert.deepEqual(ret.stopWords, undefined);
assert.deepEqual(
await client.ft.info('index'),
ret,
{
indexName: 'index',
indexOptions: [],
Expand Down Expand Up @@ -99,8 +101,8 @@ describe('INFO', () => {
indexCapacity: 128,
indexTotal: 0
},
stopWords: undefined
}
);

}, GLOBAL.SERVERS.OPEN);
});
4 changes: 1 addition & 3 deletions packages/search/lib/commands/INFO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ export interface InfoReply {
indexCapacity: NumberReply;
indexTotal: NumberReply;
};
stopWords: ArrayReply<BlobStringReply | NullReply> | undefined;
stopWords?: ArrayReply<BlobStringReply | NullReply>;
}

function transformV2Reply(reply: Array<any>, preserve?: any, typeMapping?: TypeMapping): InfoReply {
const myTransformFunc = createTransformTuplesReplyFunc<SimpleStringReply>(preserve, typeMapping);

const ret = {} as unknown as InfoReply;

ret.stopWords = undefined;

for (let i=0; i < reply.length; i += 2) {
const key = reply[i].toString();

Expand Down

0 comments on commit e1b935c

Please sign in to comment.