-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[GS] add search syntax support #83422
[GS] add search syntax support #83422
Conversation
I'm wondering if this a me thing (working from a loaner laptop and also had an error running Josh's sublinks PR but they look legit?), but I hit an error when bootstrapping this PR:
|
@ryankeairns it's not you, the PR is not on a functioning state right now. Should be in a couple of days (only opened it for CI support, shouldn't have linked it to the issue so soon) |
@ryankeairns @myasonik I gonna need your help here. so, I added the syntax support and wired the Then I tried to understand why queries such as When we were only searching by name/title, this was effectively working, as all results returned from GS did contain the search term either in their
However, with the advanced search syntax, this is no longer the case, as a term such as This is where I need you. We need to either find a way to disable the |
Thanks for all your hard work here, Pierre! @KOTungseth at this stage, it would likely be helpful to have a small section of the 7.11 Kibana docs devoted to using navigational search or add to what may already exist. In particular, mentioning examples of searchable content and how this new search syntax can filter said content. I'm happy to explain further and help write that up with your guidance. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In discussing what to do with tags and spaces in the rendered results UI, we came up with several ideas (more on that later) and would like to keep the left hand icon space open for the time being.
Specifically, we want to keep the solution/application icons, but use the empty
icon for all other result types. The end result looking like this:
I think this is a great idea! I've handed the Core UI docs over to @gchaps, so she'll be handling these docs from here on out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code & test coverage looks pretty good. Found one bug and a UX question.
One bug I've found:
If I tag a dashboard with a tag called true
and then type tag:true
into the search bar, no results appear. Same with false
. Same with a tag name that is a number, such as 42
. Probably worth a couple of unit tests to be sure we don't break this in the future. Note that this does work fine on the Tags UI filter bar in Stack Management.
/** | ||
* @public | ||
*/ | ||
export type GlobalSearchProviderFindParams = GlobalSearchFindParams; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this type? Do we expect this type to diverge in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may, depending on how we decide to internally process the parameters from the service before forwarding them to providers. Also atm the service and provider types are all separated, so it was mostly for consistency.
export const getFieldValueMap = (query: Query) => { | ||
const fieldMap = new Map<string, FilterValues>(); | ||
|
||
query.ast.clauses.forEach((clause) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in understanding that this only supports OR logic? Will we need to support AND or more complex logic in the future?
From a UX perspective, I actually find OR less useful than AND in this use case, however, I understand this emulates the Lucene query string behavior. I suspect that it's more common for users to want to use search filters to narrow down results to find a specific object. There is the use case of "I know it had either this tag or this one" but that seems less useful/common than the narrowing case. In general, I suspect users are trying to find a needle in a haystack. That said, I have 0 data to back this up 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in understanding that this only supports OR logic
That's right
Will we need to support AND or more complex logic in the future?
We might, but that would require changes in both the syntax we use (EUI Query
syntax does not support AND
for field terms, we will probably need to use/create our own syntax in that case), and in the SO find API. Also for some filters it doesn't make sense: type:(dashboard AND map)
.
See #74290 (comment) and the reply from alex for more context, but basically, we are not planning this short or mid term.
Good catch. I was aware |
And, it's gone! 9a21e53
Done in 829c8f0. I chose to handle this at the higher level ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the icon change!
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
* add search syntax parsing logic * fix ts types * use type filter in providers * move search syntax logic to the searchbar * fix test plugin types * fix test plugin types again * use `onSearch` prop to disable internal component search * add tag filter support * add FTR tests * move away from CI group 7 * fix unit tests * add unit tests * remove the API test suite * Add icons to the SO results * add test for unknown type / tag * nits * ignore case for the `type` filter * Add syntax help text * remove unused import * hide icon for non-application results * add tsdoc on query utils * coerce known filter values to string Co-authored-by: Ryan Keairns <[email protected]>
* [GS] add search syntax support (#83422) * add search syntax parsing logic * fix ts types * use type filter in providers * move search syntax logic to the searchbar * fix test plugin types * fix test plugin types again * use `onSearch` prop to disable internal component search * add tag filter support * add FTR tests * move away from CI group 7 * fix unit tests * add unit tests * remove the API test suite * Add icons to the SO results * add test for unknown type / tag * nits * ignore case for the `type` filter * Add syntax help text * remove unused import * hide icon for non-application results * add tsdoc on query utils * coerce known filter values to string Co-authored-by: Ryan Keairns <[email protected]> * fix mappings for 7.x Co-authored-by: Ryan Keairns <[email protected]>
Summary
Part of #74290
Fix #81397
What this PR does:
find
API to now accepttype
andtag
filter in addition to the search termQuery
based search syntax support to the navigational search barScreenshots
Checklist
Release note
Added advanced search syntax to the navigational search bar. It is now possible to filter results by type or by tag using the
type:dashboard my term
ortag:tag-name my term