-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat(widgets): Implement queryRuleCustomData
widget
#222
Conversation
It seems as though updating to 27.1 (39b6d85) breaks the typesense-instantsearch-adapter/test/searchExperience.test.js Lines 296 to 298 in 49c65f5
When using 27.1 it returns 263 records as opposed to the test's 250 |
@tharropoulos Yeah, I've seen some minor differences in number of results fetched between versions as we changed the defaults for some of the search parameters. So feel free to update the count of results found in the tests |
Resolved in 0f6fd6e |
Now available in v2.9.0-4 |
Rationale
We're enhancing our search experience by introducing the ability to display dynamic content based on metadata from curation rules. This feature allows us to show personalized banners, promotions, or any custom content triggered by specific search queries.
Change Summary
Added Features:
New method in
SearchResponseAdapter.js
:_adaptUserData(metadata)
: Adapts the metadata from Typesense response to the format expected by InstantSearch.js.In
app.js
(testground):queryRuleCustomData
widget to display custom content based on metadata.Code Changes:
In
SearchResponseAdapter.js
:adapt()
method to includeappliedRules
anduserData
when metadata is present in the Typesense response.In
populateProductsIndex.js
:Test Updates:
In
SearchResponseAdapter.test.js
:_adaptUserData
method to ensure correct formatting of metadata.In
widgets.test.js
:queryRuleCustomData
widget to verify proper rendering of metadata-based content.Documentation Updates:
index.html
(testground):<div>
with id "banner" to display the custom content.README.md
:queryRuleCustomData
widget from the list of unsupported widgets.Demo
To demonstrate the new feature, we've added a custom banner for Samsung phone promotions in our test environment. Here's how it works:
queryRuleCustomData
widget detects this metadata and renders it in the "#banner" element.This demo showcases how we can dynamically display relevant content based on user queries, opening up possibilities for targeted marketing, seasonal promotions, or any other context-sensitive information we want to present to our users.
PR Checklist