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

[EuiSearchBar] Use "must" semantics for simple_query_string terms in DSL gen #6717

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

s-nel
Copy link
Contributor

@s-nel s-nel commented Apr 18, 2023

Summary

Currently there is a discrepancy between query string generation and DSL generation: query string generation treats all terms as ANDed together by default because it uses must (+). DSL also ANDs clauses together by default except in the case of terms. In this case the terms are OR'd due to Elasticsearch's default behavior with the simple_query_string query.

Screenshot 2023-04-18 at 8 14 24 PM

This PR makes DSL and query string generation consistent by adding + prefix to terms so that any terms that are in the same simple_query_string query are AND'd together.

Before

Screenshot 2023-04-18 at 9 15 54 PM

After

Screenshot 2023-04-18 at 10 15 18 PM

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Added documentation
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • A changelog entry exists and is marked appropriately

- [ ] Checked in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in Chrome, Safari, Edge, and Firefox
- [ ] Checked Code Sandbox works for any docs examples
- [ ] Props have proper autodocs (using @default if default values are missing) and playground toggles
- [ ] Checked for accessibility including keyboard-only and screenreader modes
- [ ] Updated the Figma library counterpart

@s-nel s-nel added the bug label Apr 18, 2023
@s-nel s-nel self-assigned this Apr 18, 2023
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6717/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6717/

@s-nel s-nel changed the title Specify AND as default_operator for simple_query_string Use "must" semantics for simple_query_string terms in DSL gen Apr 18, 2023
@s-nel s-nel marked this pull request as ready for review April 18, 2023 10:34
@cee-chen cee-chen changed the title Use "must" semantics for simple_query_string terms in DSL gen [EuiSearchBar] Use "must" semantics for simple_query_string terms in DSL gen Apr 19, 2023
@cee-chen
Copy link
Member

So first - apologies, I'm a super noob at DSL and unfortunately most of the people who originally wrote EuiSearchBar are no longer on the EUI team 🙈 As such, and because this seems like a larger change than your previous PR (correct me if I'm wrong!), I'm going to try and ping others in with a bit more knowledge.

@tobio / @PhaedrusTheGreek - y'all have contributed some awesome bugfixes to EuiSearchBar's DSL gen in the past. Any chance I could tap one of you in to take a quick look/give a sanity check, and confirm that this change won't affect your teams' current usage of EuiSearchBar in Kibana? Thanks a million!

@cee-chen
Copy link
Member

Hey @tobio / @PhaedrusTheGreek - one more super quick ping on this PR! If I don't hear back, I'll go ahead and merge it after this Tuesday's release (giving us another week before it hits Kibana). Most of the history I'm seeing in EuiSearchBar is around term queries and not simple query strings, so my (extremely uneducated) guess is that it's probably relatively safe.

@tobio
Copy link
Member

tobio commented Apr 24, 2023

I had a quick look at this and it seems sensible. I won't be able to take a proper review before Wednesday though, I'm happy for this to be merged, but haven't done a proper review.

@cee-chen
Copy link
Member

No worries, thanks so much for responding! If @s-nel has no objections or isn't in a hurry, we can wait until this Wednesday for you to take a more thorough look!

@s-nel
Copy link
Contributor Author

s-nel commented Apr 25, 2023

I'm in no rush

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@cee-chen
Copy link
Member

Woo hoo! I really appreciate the help from both of y'all. You rock!

@cee-chen cee-chen merged commit 907cfcb into elastic:main Apr 26, 2023
jbudz pushed a commit to elastic/kibana that referenced this pull request May 15, 2023
## Summary

`eui@77.2.2` ⏩ `eui@79.0.1`

🦴 The primary changes in this upgrade are around the deprecated
`EuiLoadingContent` being removed in favor of `EuiSkeletonText`.
- Most instances have been a [direct swap of
usage](327626a),
but [some replacements were a bit more
opinionated](e6ceb36)
as I saw them as potential to take advantage of `EuiSkeletonText`'s
syntactical sugar and screen reader announcements for when state
switches to loaded.

---

## [`79.0.1`](https://github.com/elastic/eui/tree/v79.0.1)

**Bug fixes**

- Fixed broken push `EuiFlyout` behavior
([#6764](elastic/eui#6764))


## [`79.0.0`](https://github.com/elastic/eui/tree/v79.0.0)

- Updated all `EuiSkeleton` components with new props that allow for
more control over screen reader live announcements:
`announceLoadingStatus`, `announceLoadedStatus`, and `ariaLiveProps`
([#6752](elastic/eui#6752))
- Improved keyboard accessibility in `EuiPageHeader` by ensuring the
right side menu items come into focus from left to right.
([#6753](elastic/eui#6753))

**Breaking changes**

- Removed deprecated `EuiLoadingContent`. Use the `EuiSkeleton`
components instead. ([#6754](elastic/eui#6754))


## [`78.0.0`](https://github.com/elastic/eui/tree/v78.0.0)

- Improved the contrast ratio of `EuiCheckbox`, `EuiRadio`, and
`EuiSwitch` in their unchecked states to meet WCAG AA guidelines.
([#6729](elastic/eui#6729))
- Added React Testing Library `*ByTestSubject` custom commands to
`within()`. RTL utilities can be imported from
`@elastic/eui/lib/test/rtl`.
([#6737](elastic/eui#6737))
- Updated `EuiAvatar` to support a new letter `casing` prop that allow
customizing text capitalization
([#6739](elastic/eui#6739))
- Updated `EuiFocusTrap` to support the `gapMode` prop configuration
(now defaults to `padding`)
([#6744](elastic/eui#6744))

**Bug fixes**

- Fixed inconsistency in `EuiSearchBar`'s AND/OR semantics between DSL
and query string generation
([#6717](elastic/eui#6717))
- Fixed `EuiFieldNumber`'s native browser validity detection causing
extra unnecessary rerenders
([#6741](elastic/eui#6741))
- Fixed the `scrollLock` property on `EuiFocusTrap` (and other
components using `EuiFocusTrap`, such as `EuiFlyout` and `EuiModal`) to
no longer block scrolling on nested portalled content, such as combobox
dropdowns ([#6744](elastic/eui#6744))

**Breaking changes**

- `EuiAvatar`s with the default `user` type will now default to
capitalizing all initials in uppercase
([#6739](elastic/eui#6739))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jasonrhodes pushed a commit to elastic/kibana that referenced this pull request May 17, 2023
## Summary

`eui@77.2.2` ⏩ `eui@79.0.1`

🦴 The primary changes in this upgrade are around the deprecated
`EuiLoadingContent` being removed in favor of `EuiSkeletonText`.
- Most instances have been a [direct swap of
usage](327626a),
but [some replacements were a bit more
opinionated](e6ceb36)
as I saw them as potential to take advantage of `EuiSkeletonText`'s
syntactical sugar and screen reader announcements for when state
switches to loaded.

---

## [`79.0.1`](https://github.com/elastic/eui/tree/v79.0.1)

**Bug fixes**

- Fixed broken push `EuiFlyout` behavior
([#6764](elastic/eui#6764))


## [`79.0.0`](https://github.com/elastic/eui/tree/v79.0.0)

- Updated all `EuiSkeleton` components with new props that allow for
more control over screen reader live announcements:
`announceLoadingStatus`, `announceLoadedStatus`, and `ariaLiveProps`
([#6752](elastic/eui#6752))
- Improved keyboard accessibility in `EuiPageHeader` by ensuring the
right side menu items come into focus from left to right.
([#6753](elastic/eui#6753))

**Breaking changes**

- Removed deprecated `EuiLoadingContent`. Use the `EuiSkeleton`
components instead. ([#6754](elastic/eui#6754))


## [`78.0.0`](https://github.com/elastic/eui/tree/v78.0.0)

- Improved the contrast ratio of `EuiCheckbox`, `EuiRadio`, and
`EuiSwitch` in their unchecked states to meet WCAG AA guidelines.
([#6729](elastic/eui#6729))
- Added React Testing Library `*ByTestSubject` custom commands to
`within()`. RTL utilities can be imported from
`@elastic/eui/lib/test/rtl`.
([#6737](elastic/eui#6737))
- Updated `EuiAvatar` to support a new letter `casing` prop that allow
customizing text capitalization
([#6739](elastic/eui#6739))
- Updated `EuiFocusTrap` to support the `gapMode` prop configuration
(now defaults to `padding`)
([#6744](elastic/eui#6744))

**Bug fixes**

- Fixed inconsistency in `EuiSearchBar`'s AND/OR semantics between DSL
and query string generation
([#6717](elastic/eui#6717))
- Fixed `EuiFieldNumber`'s native browser validity detection causing
extra unnecessary rerenders
([#6741](elastic/eui#6741))
- Fixed the `scrollLock` property on `EuiFocusTrap` (and other
components using `EuiFocusTrap`, such as `EuiFlyout` and `EuiModal`) to
no longer block scrolling on nested portalled content, such as combobox
dropdowns ([#6744](elastic/eui#6744))

**Breaking changes**

- `EuiAvatar`s with the default `user` type will now default to
capitalizing all initials in uppercase
([#6739](elastic/eui#6739))

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants