Skip to content
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

MOD-6540: Support EMPTY indexing for TEXT fields #4622

Merged
merged 11 commits into from
May 12, 2024

Conversation

raz-mon
Copy link
Collaborator

@raz-mon raz-mon commented May 7, 2024

Describe the changes in the pull request

Currently we discard empty strings for TEXT fields in our index, i.e., we don't index them and don't allow querying for them as well.

This PR adds the support of indexing and querying for such empty strings ('') for TEXT fields.

This is done by adding the ISEMPTY keyword in the index creation for the desired TEXT field, as such:

FT.CREATE idx SCHEMA my_field TEXT ISEMPTY

Then, querying for such empty values is done via the isempty(@my_field) syntax in the query, as such:

FT.SEARCH idx "isempty(@myfield) ... "

This syntax is compatible with all other query constructs, just as any other first-class citizen.

Some cleaning and commenting was done as well,

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Copy link

codecov bot commented May 7, 2024

Codecov Report

Attention: Patch coverage is 89.55224% with 14 lines in your changes are missing coverage. Please review.

Project coverage is 85.90%. Comparing base (c32a768) to head (781f44d).

Files Patch % Lines
src/spec.c 93.50% 5 Missing ⚠️
src/inverted_index.c 0.00% 3 Missing ⚠️
src/doc_table.c 50.00% 1 Missing ⚠️
src/document.c 80.00% 1 Missing ⚠️
src/json.c 66.66% 1 Missing ⚠️
src/numeric_index.c 50.00% 1 Missing ⚠️
src/query.c 91.66% 1 Missing ⚠️
src/query_optimizer.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##           razmon-feature_empty_text_indexing    #4622      +/-   ##
======================================================================
+ Coverage                               85.79%   85.90%   +0.11%     
======================================================================
  Files                                     188      188              
  Lines                                   33121    33089      -32     
======================================================================
+ Hits                                    28417    28426       +9     
+ Misses                                   4704     4663      -41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@raz-mon raz-mon requested review from oshadmi and nafraf May 8, 2024 07:41
Copy link
Collaborator

@nafraf nafraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. Some comments

src/query.c Show resolved Hide resolved
src/spec.c Show resolved Hide resolved
@raz-mon raz-mon requested a review from nafraf May 8, 2024 13:53
src/document.c Outdated Show resolved Hide resolved
src/document.c Outdated Show resolved Hide resolved
src/query.c Outdated Show resolved Hide resolved
src/query.c Show resolved Hide resolved
src/query.c Outdated Show resolved Hide resolved
src/rlookup.h Show resolved Hide resolved
src/spec.c Show resolved Hide resolved
src/spec.c Show resolved Hide resolved
Copy link
Collaborator

@oshadmi oshadmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩 Very nice! A few more comments.

src/tag_index.c Show resolved Hide resolved
src/tokenize.c Show resolved Hide resolved
src/tokenize.h Outdated Show resolved Hide resolved
tests/pytests/test_empty.py Outdated Show resolved Hide resolved
tests/pytests/test_empty.py Outdated Show resolved Hide resolved
tests/pytests/test_empty.py Show resolved Hide resolved
tests/pytests/test_empty.py Show resolved Hide resolved
tests/pytests/test_empty.py Show resolved Hide resolved
tests/pytests/test_empty.py Show resolved Hide resolved
tests/pytests/test_empty.py Show resolved Hide resolved
Copy link
Collaborator

@oshadmi oshadmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ Minor comments

src/document.c Outdated Show resolved Hide resolved
src/document.c Outdated Show resolved Hide resolved
@raz-mon raz-mon merged commit 9a7150f into razmon-feature_empty_text_indexing May 12, 2024
10 checks passed
@raz-mon raz-mon deleted the razmon-empty_text_indexing branch May 12, 2024 15:20
github-merge-queue bot pushed a commit that referenced this pull request May 22, 2024
* MOD-6540: Support EMPTY indexing for TEXT fields (#4622)

* Resolving conflicts

* Updatet commands.json file
github-merge-queue bot pushed a commit that referenced this pull request May 22, 2024
* MOD-6540: Support EMPTY indexing for TEXT fields (#4622)

* Resolving conflicts

* Updatet commands.json file
raz-mon added a commit that referenced this pull request May 22, 2024
* MOD-6540: Support EMPTY indexing for TEXT fields (#4622)

* Resolving conflicts

* Updatet commands.json file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants