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 regex operator to Atlas Search #1587

Merged
merged 9 commits into from
Jan 16, 2025
Merged

Conversation

joykim1005
Copy link
Contributor

Ticket

JAVA-5726

Description

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

Testing

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

@joykim1005 joykim1005 requested review from a team and vbabanin 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
@vbabanin vbabanin requested a review from katcharov January 8, 2025 00:47
Copy link
Contributor

@katcharov katcharov left a comment

Choose a reason for hiding this comment

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

Just a couple of minor nits.

Comment on lines 92 to 94
public RegexSearchOperator allowAnalyzedField(final boolean isAllowed) {
return newWithAppendedValue("allowAnalyzedField", notNull("isAllowed", isAllowed));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public RegexSearchOperator allowAnalyzedField(final boolean isAllowed) {
return newWithAppendedValue("allowAnalyzedField", notNull("isAllowed", isAllowed));
}
public RegexSearchOperator allowAnalyzedField(final boolean allowAnalyzedField) {
return newWithAppendedValue("allowAnalyzedField", allowAnalyzedField);
}

Redundant null check. For naming, a similar method uses the same param name as the method itself:

    public SearchOptions returnStoredSource(final boolean returnStoredSource) {
        return newAppended("returnStoredSource", new BsonBoolean(returnStoredSource));
    }

This can be changed in the interfaces as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it.

/**
* Creates a new {@link RegexSearchOperator} that uses allowAnalyzedField.
*
* @param isAllowed The boolean to run the query against an analyzed field.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param isAllowed The boolean to run the query against an analyzed field.
* @param isAllowed Must be set to true if the query is run against an analyzed field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@joykim1005 joykim1005 requested a review from katcharov January 10, 2025 17:57
@joykim1005
Copy link
Contributor Author

com.mongodb.client.ClientSideEncryptionE…estExternal_withExternalKeyVault__false is failing and is unlikely caused by this PR and is happening in others as well.

@joykim1005 joykim1005 requested a review from katcharov January 15, 2025 19:33
Copy link
Contributor

@katcharov katcharov left a comment

Choose a reason for hiding this comment

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

LGTM

@joykim1005 joykim1005 merged commit e022dbd 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