Skip to content

add missing fields support to schema (v4) #2789

New issue

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

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update to final design doc
  • Loading branch information
sjpotter committed Jul 11, 2024
commit dd3929438738a9fb7f12901b17ee1aacfb170b0c
10 changes: 5 additions & 5 deletions packages/search/lib/commands/CREATE.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,17 @@ describe('CREATE', () => {
});

describe('Missing Values', () => {
it('with ISNULL', () => {
it('with INDEX_EMPTY', () => {
assert.deepEqual(
transformArguments('index', {
field: {
type: SchemaFieldTypes.TEXT,
MISSING_VALUES: {
IS_NULL: true
INDEX_EMPTY: true
}
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'ISNULL']
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'INDEXEMPTY']
);
});

Expand All @@ -463,11 +463,11 @@ describe('CREATE', () => {
field: {
type: SchemaFieldTypes.TEXT,
MISSING_VALUES: {
IS_MISSING: true
INDEX_MISSING: true
}
}
}),
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'ISMISSING']
['FT.CREATE', 'index', 'SCHEMA', 'field', 'TEXT', 'INDEXMISSING']
);
});
});
Expand Down
14 changes: 7 additions & 7 deletions packages/search/lib/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,21 +190,21 @@ export enum SchemaFieldTypes {
}

export interface MissingValues {
IS_NULL?: boolean;
IS_MISSING?: boolean;
INDEX_EMPTY?: boolean;
INDEX_MISSING?: boolean;
}

function pushMissingValues(args: RedisCommandArguments, missingValues?: MissingValues) {
if (!missingValues) {
return;
}
if (missingValues.IS_MISSING) {
args.push("ISMISSING");

if (missingValues.INDEX_EMPTY) {
args.push("INDEXEMPTY");
}

if (missingValues.IS_NULL) {
args.push("ISNULL");
if (missingValues.INDEX_MISSING) {
args.push("INDEXMISSING");
}
}

Expand Down
Loading