-
Notifications
You must be signed in to change notification settings - Fork 554
feat(helper): support multifeed composition responses #6954
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: feat/composition-multifeed
Are you sure you want to change the base?
Changes from 2 commits
a49091b
343e93a
450d71a
4ce052c
46ee2b1
3b56311
ec3854e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1695,7 +1695,8 @@ AlgoliaSearchHelper.prototype._runComposition = function () { | |
|
|
||
| states.push({ | ||
| state: derivedState, | ||
| queriesCount: derivedStateQueries.length, | ||
| // Infinity so splice grabs all feed results from a multifeed composition response | ||
| queriesCount: Infinity, | ||
Haroenv marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| helper: derivedHelper, | ||
| }); | ||
|
|
||
|
|
@@ -1884,12 +1885,33 @@ AlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function ( | |
| return; | ||
| } | ||
|
|
||
| helper.lastResults = new SearchResults( | ||
| state, | ||
| specificResults, | ||
| self._searchResultsOptions | ||
| ); | ||
| if (rawContent !== undefined) helper.lastResults._rawContent = rawContent; | ||
| // Multifeed composition: build per-feed SearchResults map | ||
| if (specificResults.length > 0 && specificResults[0].feedID) { | ||
e-krebs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| var feedResults = {}; | ||
| var feedOrder = specificResults.map(function (r) { | ||
| return r.feedID; | ||
| }); | ||
| specificResults.forEach(function (r) { | ||
| var sr = new SearchResults(state, [r], self._searchResultsOptions); | ||
| if (rawContent !== undefined) sr._rawContent = rawContent; | ||
| feedResults[r.feedID] = sr; | ||
| }); | ||
| helper.lastResults = new SearchResults( | ||
| state, | ||
| [specificResults[0]], | ||
| self._searchResultsOptions | ||
| ); | ||
| if (rawContent !== undefined) helper.lastResults._rawContent = rawContent; | ||
| helper.lastResults._feedResults = feedResults; | ||
| helper.lastResults._feedOrder = feedOrder; | ||
|
||
| } else { | ||
| helper.lastResults = new SearchResults( | ||
| state, | ||
| specificResults, | ||
| self._searchResultsOptions | ||
| ); | ||
| if (rawContent !== undefined) helper.lastResults._rawContent = rawContent; | ||
| } | ||
|
|
||
| helper.emit('result', { | ||
| results: helper.lastResults, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.