-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Introduce two filters to select documents with null
and empty fields
#3571
Conversation
Uffizzi Ephemeral Environment
|
bf66e94
to
43ff236
Compare
df4d553
to
7c0cd71
Compare
IS NULL
filterNULL
fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! Looking good (I trust you on the grenad
stuff as I couldn't get all it is doing, but it is evidently similar to the existing code)
Regarding tests:
- doesn't appear in
milli/src/snapshot_tests
. Similarly we could have a db_snap withfacet_ids_null_docids
in the tests of delete_documents.rs - in
milli/src/update/index_documents/mod.rs
we have anindex_documents_check_exists_database
, do we want same thing for the new db?index_documents_check_null_database
? - I see the tests in search reimplement a way to extract the expected results from the filter, I'm a bit less comfortable than with tests against known and hardcoded expected results since there could be a bug in that implementation. It looks correct upon reading it though.
Regarding the correct deletion of the docids it looks similar to the exists db, so if there are no bugs there there are no bugs here.
I have a few suggestions/comments (see below)
milli/src/update/index_documents/extract/extract_fid_docid_facet_values.rs
Outdated
Show resolved
Hide resolved
milli/src/update/index_documents/extract/extract_fid_docid_facet_values.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me except for the name on one method 🙆
Co-authored-by: Louis Dureuil <louis@meilisearch.com> aaa
a784346
to
e064c52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lovely ❤️
So I added the tests you were talking about @dureuill. Thank you for pointing that. I fixed the changes you asked for. I am now ready to create a tag for the prototype. Could you please 👍 on this comment if you think I can create it right now? |
I just created a |
Thanks for this great PR! I just tested it on dart client and it works perfectly |
0138e83
to
72123c4
Compare
null
fieldsnull
and empty fields
e5ed64b
to
cf34d1c
Compare
should |
Hey @ahmednfwela,
Indeed For your information, I pushed a new prototype version named I updated the main message accordingly to reflect the new syntax. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should maybe add automated tests on the failed parsing of "value NULL", "value NOT NULL", "value IS", "value IS NOT", "value IS EXISTS", etc.
Still would be interested in this kind of tests, but otherwise the code still looks good to me after the IS EMPTY
addition. Thank you.
Just did the tests for that, tell me what you think about my insta tests 🔬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😭 beautiful thank you
what do you think about adding filters for field types as well ? |
Hello @ahmednfwela Thanks again for your involvement in this feature! ❤️ |
Thanks for informing me, I created the discussion meilisearch/product#634 |
I would be nice to have this merged, @irevoire is there something else needed? |
Hey @tonivega, we're just checking a few last things on our side. But this feature should be land in the next release 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors merge
Build succeeded:
|
Pull Request
Related issue
This PR implements the
X IS NULL
,X IS NOT NULL
,X IS EMPTY
,X IS NOT EMPTY
filters that this comment is describing in a very detailed manner.What does this PR do?
IS NULL
andIS NOT NULL
This PR will be exposed as a prototype for now. Below is the copy/pasted version of a spec that defines this filter.
IS NULL
matches fields thatEXISTS
AND= IS NULL
IS NOT NULL
matches fields thatNOT EXISTS
OR!= IS NULL
{"name": "A", "price": null}
{"name": "A", "price": 10}
{"name": "A"}
price IS NULL
would match 1price IS NOT NULL
orNOT price IS NULL
would match 2,3price EXISTS
would match 1, 2price NOT EXISTS
orNOT price EXISTS
would match 3common query :
(price EXISTS) AND (price IS NOT NULL)
would match 2IS EMPTY
andIS NOT EMPTY
IS EMPTY
matches Array[]
, Object{}
, or String""
fields thatEXISTS
and are emptyIS NOT EMPTY
matches fields thatNOT EXISTS
OR are not empty.{"name": "A", "tags": null}
{"name": "A", "tags": [null]}
{"name": "A", "tags": []}
{"name": "A", "tags": ["hello","world"]}
{"name": "A", "tags": [""]}
{"name": "A"}
{"name": "A", "tags": {}}
{"name": "A", "tags": {"t1":"v1"}}
{"name": "A", "tags": {"t1":""}}
{"name": "A", "tags": ""}
tags IS EMPTY
would match 3,7,10tags IS NOT EMPTY
orNOT tags IS EMPTY
would match 1,2,4,5,6,8,9tags IS NULL
would match 1tags IS NOT NULL
orNOT tags IS NULL
would match 2,3,4,5,6,7,8,9,10tags EXISTS
would match 1,2,3,4,5,7,8,9,10tags NOT EXISTS
orNOT tags EXISTS
would match 6common query :
(tags EXISTS) AND (tags IS NOT NULL) AND (tags IS NOT EMPTY)
would match 2,4,5,8,9What should the reviewer do?