-
Notifications
You must be signed in to change notification settings - Fork 368
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
[elasticsearch-connector] Implement basefilters #768
[elasticsearch-connector] Implement basefilters #768
Conversation
…tate are sent in API request
@@ -386,7 +386,17 @@ describe("AppSearchAPIConnector", () => { | |||
{ | |||
all: [ | |||
{ | |||
date_made: "yesterday" | |||
title: "Acadia" |
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.
This change seems a little odd but i believe its the correct behaviour here. The test case here has two filters in the request state and one filter in the queryConfig. Previously it was only providing the filter in the queryConfig
to the API. Now its passing all three filters to the API. I believe it should be passing all three filters to the API.
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.
But it looks like we're missing the date_made: "yesterday"
filter from the call. Is this expected?
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 spot! So the testcase is incorrect here, the date_made: "yesterday"
should of been present in requestState.filters
too, as searchDriver runs mergeFilter
which mutates the requestState.filters
with filters from the queryConfig.filters
Ive updated the testcase to better reflect the state.
@@ -334,9 +334,9 @@ describe("searchQuery config", () => { | |||
]); | |||
}); | |||
|
|||
it("will remove filters parameter from queryConfig since its merged into state", () => { | |||
it("will not remove filters parameter from queryConfig", () => { |
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.
this test was changed as the queryConfig.filters still remain as its needed by the connectors. See PR description for more detail on the flow.
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.
Working as expected now! Great work, Joe! 👍
* Implement basefilters * update test to assert the filters set in config is not removed * update app search test to assert both filters from queryConfig + UI state are sent in API request * exclude filters that are present in baseFilters * update test name * remove the filter configuration * remove unneeded rename from spread * update test to better reflect the state of queryConfig and requestState * support range filters Co-authored-by: Vadim Yakhin <vadim.yakhin@elastic.co>
Fixes #768
Observations:
Proposal
Changes to search-ui
Changes to app-search connector
queryConfig.filters
+requestState.filters
and mutaterequestState.filters
queryConfig.filters
in theonSearch
event handler (as the filters are already present in therequestState.filters
)Changes to elasticsearch-connector
queryConfig.filters
are transformed into lucene queries and placed into searchkit as a baseFilterrequestState.filters
will be pruned where the filters exist in thequeryConfig.filters
(due to the mergedFilters behaviour in search-ui) and then are added as normal searchkit filterscreate a ticket to address the App search disjunctive + global filters issue