-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix recent queries not working for DQL and Lucene #10837
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
base: main
Are you sure you want to change the base?
Conversation
The Recent Queries button was not working for DQL and Lucene query languages due to two issues in the query editor: 1. The RecentQueriesTable component visibility was gated by the useQueryEditor flag, which is false for DQL/Lucene queries. 2. The onSubmit function never called addToQueryHistory(), so queries were not being saved to history in the first place. This fix removes the useQueryEditor condition from the table visibility and adds the addToQueryHistory() call in onSubmit to ensure all query languages are properly saved and displayed in recent queries. Fixes opensearch-project#10810 Signed-off-by: Andrew Hopp <[email protected]>
❌ Invalid Changelog HeadingThe '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax. |
❌ Changeset File Not Added YetPlease ensure manual commit for changeset file 10837.yml under folder changelogs/fragments to complete this PR. File still missing. |
Signed-off-by: Andrew Hopp <[email protected]>
|
Updated PR to align to template and added changeset file for PR |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10837 +/- ##
==========================================
- Coverage 60.71% 60.70% -0.01%
==========================================
Files 4524 4524
Lines 121776 121777 +1
Branches 20369 20369
==========================================
- Hits 73935 73929 -6
- Misses 42640 42644 +4
- Partials 5201 5204 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ananzh, @ashwin-pc, or @abbyhu2000? Thoughts on the code changes? |
|
Or maybe @TackAdam or @d-buckner? 👀 |
Description
Fixes the Recent Queries button not working for DQL and Lucene query languages in the Discover plugin.
Issues Resolved
Fixes #10810
Root Cause
The Recent Queries feature was broken for DQL (kuery) and Lucene queries due to two issues in the query editor (
src/plugins/data/public/ui/query_editor/query_editor.tsx):Visibility condition bug: The
RecentQueriesTablecomponent visibility was gated byisRecentQueryVisible && useQueryEditor. TheuseQueryEditorflag isfalsefor DQL and Lucene queries, preventing the dropdown from ever showing.Missing history save: The
onSubmitfunction never calledqueryString.addToQueryHistory(), so queries were not being saved to history in the first place.Changelog
src/plugins/data/public/ui/query_editor/query_editor.tsxLine 487: Removed
&& useQueryEditorfromRecentQueriesTablevisibility conditionisVisible={isRecentQueryVisible && useQueryEditor}isVisible={isRecentQueryVisible}Lines 157-160: Added
queryString.addToQueryHistory()call inonSubmitfunctionTesting
Tested locally with DQL and Lucene queries in the Discover plugin:
DQL:

Lucene:

Check List