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

Support parenthesis in EuiSearchBar values #2791

Merged

Conversation

chandlerprall
Copy link
Contributor

@chandlerprall chandlerprall commented Jan 24, 2020

Summary

Fixes #2788

Adds support for ( and ) in EuiSearchBar's expressions when part of a phrase or escaped.

Example

  • ")" \(
  • (owner:"(" OR owner:\))
  • owner:"dewey (Jr)"

Parenthesis can optionally be escaped within a phrase as well:

owner:"dewey \(Jr\)"

/cc @pugnascotia for pegjs experience and @bevacqua for EuiSearchBar experience, as optional reviewers

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile
- [ ] Checked in IE11 and Firefox
- [ ] Props have proper autodocs
- [ ] Added documentation examples

  • Added or updated jest tests
  • Checked for breaking changes and labeled appropriately
    - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@@ -138,12 +138,13 @@ containsValue

phrase
= '"' space? phrase:(
phraseWord? (space phraseWord)* { return unescapeValue(text()); }
(phraseWord+)? (space phraseWord+)* { return unescapeValue(text()); }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expanding phraseWord (below) with parenthesis support, instead of adding them to wordChar, means that the parenthesis is grouped in a different phraseWord than the rest of the phrase; this line's change allows multiple phaseWords to exist next to each other without spaces separating

Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

LGTM; tested locally.

Needs a changelog entry

Copy link
Contributor

@pugnascotia pugnascotia left a comment

Choose a reason for hiding this comment

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

I checked out the branch, seems to work as advertised 👍

@chandlerprall chandlerprall merged commit 6332854 into elastic:master Feb 3, 2020
@chandlerprall chandlerprall deleted the bug/2788-search-bar-escaped-parens branch February 3, 2020 19:57
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.

EuiSearchBar escaping parenthesis
3 participants