Created
April 30, 2022 12:56
-
-
Save Yudhajitadhikary/dc80721c32824c7e25ebe14d5585b152 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const algoliasearch= require("algoliasearch") | |
| module.exports={ | |
| getAlgoliaResults: function (request_object={},name){ | |
| const SearchIndex=name=='name'?'Demo-Index-desc(name)':name=='price'?'Demo-Index-desc(price)':'Demo-Index' | |
| return new Promise((resolve,reject)=>{ | |
| algoliasearch('AAFOFP264H','47a036007d9665e81cd85914d7b83913').initIndex(SearchIndex).search('',request_object).then(response=>{ | |
| resolve(response) | |
| }) | |
| .catch(error=>reject(error)) | |
| }) | |
| }, | |
| getAlgoliaSearchResults: function (request_object={},query){ | |
| const SearchIndex='Demo-Index' | |
| return new Promise((resolve,reject)=>{ | |
| algoliasearch('AAFOFP264H','47a036007d9665e81cd85914d7b83913').initIndex(SearchIndex).search(query,request_object).then(response=>{ | |
| resolve(response) | |
| }) | |
| .catch(error=>reject(error)) | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment