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

Search - clean up case sensitivity option in term-based queries #63923

Closed
wants to merge 2 commits into from

Conversation

markharwood
Copy link
Contributor

Case sensitivity options are an uncomfortable fit with a boolean setting - changing to enum.
Closes #63893

@markharwood markharwood added :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.10.0 labels Oct 20, 2020
@markharwood markharwood self-assigned this Oct 20, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Oct 20, 2020
@mayya-sharipova mayya-sharipova self-requested a review October 20, 2020 11:08
/**
* use the field's setting for handling matching
*/
FIELD_DEFAULT(new ParseField("field_default")),
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering why we organize case_sensitivity options as parseFields, why not just strings?
as field_default and insensitive are not field names, but rather field values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Mayya. I was just following the pattern from collect_mode in aggs which uses an enum. This all may be academic because we might be going with a simple boolean, pending discussion (addressed in alternative PR #63926 )

Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

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

@markharwood Thanks Mark, this PR LGTM, I left some comments.

Indeed, with enumeration is a more understandable API.

if (caseInsensitive != DEFAULT_CASE_INSENSITIVITY) {
builder.field(CASE_INSENSITIVE_FIELD.getPreferredName(), caseInsensitive);
if (caseSensitivityMode != CaseSensitivityMode.FIELD_DEFAULT) {
builder.field(CaseSensitivityMode.KEY.getPreferredName(), caseSensitivityMode.parseField().getPreferredName().toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that in getPreferredName().toString() ,toString() part is redundant.
Here and in other queryBuilers as well

@markharwood
Copy link
Contributor Author

Thanks for the review, Mayya but closing in favour of #63926
Thanks for looking at that too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.10.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update semantics or definition of case_insensitive in term queries
4 participants