-
Notifications
You must be signed in to change notification settings - Fork 5
Add API support for checking if a search field exists in a result (e.g. not null) #700
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
base: develop
Are you sure you want to change the base?
Conversation
Updated the language to allow for finding documents that have a specific field name. If the FIELD is given, then it assumes that an exact match is being requested. If a STRINGVAL is given, then it treats it as a regular expression. Processing regular expressions collects all of the known field names from the mapping and pulls out all matching field names. It then creates an existance check for each of the matching field names.
|
The branch test failed because of registry-loader. Really not part of these code changes... |
Use the functionality in ProductsController to collect the property mappings. Use the names in mappings to then find the set of matches for the exists.
|
Let me know about the bomb out. If you want it then I will add the statement to do it. Otherwise it is ready; meaning it fails silently from the end users perspective. |
|
@al-niessner per my comment on the issue, let's return an error if something isn't as expected unless @tloubrieu-jpl has other ideas. |
|
@al-niessner can we had a 2+ regression tests to the postman suite to support this? |
jordanpadams
left a comment
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.
See other comments for error handling and tests needed
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.
Pull Request Overview
This PR implements field existence checking functionality for queries, allowing users to search for documents based on whether a field exists. The changes include grammar updates to support an exists operator, modifications to the search listener to handle existence queries, and various code quality improvements including better logging patterns and test refinements.
Key changes:
- Added grammar support for existence queries in the search language
- Implemented existence checking logic with support for both direct field names and regex patterns
- Refactored code to improve logging practices and remove unused imports
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| Search.g4 | Added EXISTS token and existence rule to grammar for field existence queries |
| Antlr4SearchListener.java | Implemented exitExistence method to handle existence queries, added ConnectionContext dependency, improved logging |
| ProductsController.java | Made productPropertiesList method static to support existence checking, improved logging patterns |
| RegistrySearchRequestBuilder.java | Changed parseQueryString to instance method, improved logging with parameterized messages, removed unused imports |
| Antlr4SearchListenerTest.java | Updated tests to pass ConnectionContext parameter, improved assertion patterns, changed visibility modifiers |
| TestParsing.java | Added stub methods for existence context handling, improved assertion order in tests |
| CHANGELOG.md | Updated version and changelog entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
service/src/main/java/gov/nasa/pds/api/registry/model/Antlr4SearchListener.java
Outdated
Show resolved
Hide resolved
service/src/main/java/gov/nasa/pds/api/registry/model/Antlr4SearchListener.java
Outdated
Show resolved
Hide resolved
service/src/test/java/gov/nasa/pds/api/registry/opensearch/Antlr4SearchListenerTest.java
Outdated
Show resolved
Hide resolved
service/src/main/java/gov/nasa/pds/api/registry/model/Antlr4SearchListener.java
Show resolved
Hide resolved
…archListener.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…lr4SearchListenerTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
@al-niessner just created some documentation for this here: NASA-PDS/registry#445 I will also email the internal wiki page. |
Added various tests for specific names and wildcards. Both exists and not exists. Flushed out some bugs and fixed them.
|



🗒️ Summary
Allows queries to collect documents based on the existence of a field.
⚙️ Test Data and/or Report
Do not know yet
♻️ Related Issues
Closes #406