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

Add queryString operator to Atlas Search #1588

Merged
merged 8 commits into from
Jan 16, 2025
Merged

Conversation

joykim1005
Copy link
Contributor

@joykim1005 joykim1005 commented Dec 26, 2024

Ticket

JAVA-5727

Description

There are several Atlas Search query operators that are not implemented with first class support in the Java driver. This PR adds the queryString operator to Atlas Search.

Testing

  • ran ./gradlew check
  • ran atlas-search-test on Evergreen
  • ran SearchOperatorTest
  • ran everygreen patch on all tests

@joykim1005 joykim1005 requested review from a team and nhachicha and removed request for a team January 6, 2025 14:19
@joykim1005 joykim1005 marked this pull request as ready for review January 7, 2025 15:36
* @return The requested {@link SearchOperator}.
* @mongodb.atlas.manual atlas-search/queryString/ queryString operator
*/
static QueryStringSearchOperator queryString(final SearchPath defaultPath, final String query) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should not be possible to write queryString(wildcardPath(... - though the query supports wildcards, I believe the defaultPath itself does not. Could you confirm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, will change SearchPath to FieldSearchPath to limit defaultPath to use wildcardPath!

* @return The requested `SearchOperator`.
* @see [[https://www.mongodb.com/docs/atlas/atlas-search/queryString/ queryString operator]]
*/
def queryString(defaultPath: SearchPath, query: String): QueryStringSearchOperator =
Copy link
Contributor

@nhachicha nhachicha Jan 10, 2025

Choose a reason for hiding this comment

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

@katcharov Shouldn't we also include the score parameter? (see example https://www.mongodb.com/docs/atlas/atlas-search/queryString/) or is it added as part of the aggregation pipeline separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left out the score as a parameter since it's an optional field and instead have it in the interface. All the other search operators also include score in the interface with overrides!

@joykim1005 joykim1005 requested a review from katcharov January 10, 2025 19:21
@joykim1005 joykim1005 merged commit 0d87508 into mongodb:main Jan 16, 2025
2 of 3 checks passed
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.

3 participants