-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(recommend): map recommend results to widgets
- Loading branch information
1 parent
27e6f50
commit a5a87dd
Showing
12 changed files
with
221 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/algoliasearch-helper/src/RecommendResults/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Constructor for SearchResults | ||
* @class | ||
* @classdesc SearchResults contains the results of a query to Algolia using the | ||
* {@link AlgoliaSearchHelper}. | ||
* @param {RecommendParameters} state state that led to the response | ||
* @param {Record<string,RecommendResultItem>} results the results from algolia client | ||
**/ | ||
function RecommendResults(state, results) { | ||
this._state = state; | ||
this._rawResults = results; | ||
|
||
// eslint-disable-next-line consistent-this | ||
var self = this; | ||
|
||
state.params.forEach(function (param) { | ||
var id = param.$$id; | ||
self[id] = results[id]; | ||
}); | ||
} | ||
|
||
RecommendResults.prototype = { | ||
constructor: RecommendResults, | ||
}; | ||
|
||
module.exports = RecommendResults; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.