-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: map recommend results to widgets
- Loading branch information
1 parent
2518d91
commit 3d3bf1f
Showing
10 changed files
with
183 additions
and
20 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
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 {array.<object>} 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; | ||
|
||
results.forEach(function (result, index) { | ||
var id = state.params[index].$$id; | ||
self[id] = result; | ||
}); | ||
} | ||
|
||
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
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.