SOLR-18197: Add root document query shortcut support to NestPathField#4512
SOLR-18197: Add root document query shortcut support to NestPathField#4512abumarjikar wants to merge 15 commits into
Conversation
dsmiley
left a comment
There was a problem hiding this comment.
Thanks. Looking to see this used widespread in code & docs. The goal is to ensure no user sees that ugly/confusing syntax that was previously necessary.
dsmiley
left a comment
There was a problem hiding this comment.
still definitely looking for the application of this in the codebase + doc updates
| "parent_filt", "(*:* -{!prefix f='_nest_path_' v='" + parent_path + "/'})", | ||
| "parent_filt", "({!field f='_nest_path_' v='" + parent_path + "/'})", |
There was a problem hiding this comment.
That change has a different underlying query & semantic effect. Formerly it found all docs separate from that parent path, thus matched not only the root doc but also /aa and /ff if that exists, say. You changed it to only match documents at /aa exactly.
| return params( | ||
| "q", "{!parent which=$parent_filt v=$child_q}", | ||
| "parent_filt", "(*:* -{!prefix f='_nest_path_' v='" + path + "'})", | ||
| "parent_filt", "({!field f='_nest_path_' v='" + path + "'})", |
There was a problem hiding this comment.
again, these are not equivalent
dsmiley
left a comment
There was a problem hiding this comment.
more to do... not ready for my re-review
|
Audit usages of |
|
@dsmiley I audited the usage of
|
https://issues.apache.org/jira/browse/SOLR-18197
Description
This pull request introduces a quick and intuitive shortcut to query root documents within hierarchical/nested data structures using the NestPathField. Currently, finding root-level documents (which do not have a nested path defined) requires a more verbose or explicit query syntax. This change provides a cleaner "ease of use" developer experience when dealing with nested child documents.
Solution
When a query is made against this field with an empty value, a null value, or a root slash ("/"), it automatically constructs and returns a BooleanQuery that targets only top-level root documents. It accomplishes this by matching all documents and explicitly excluding any documents where the nested path field exists:
MUST: MatchAllDocsQuery
MUST_NOT: ExistenceQuery (for the NestPathField)
For all other standard path inputs, it safely falls back to the default super.getFieldQuery(...) behavior.
Tests
Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.