(query, params)
| 4 | |
| 5 | export default class AlgoliaService extends Service { |
| 6 | async search(query, params) { |
| 7 | if (query) { |
| 8 | if (Array.isArray(query) && !params) { |
| 9 | // if multiple indices |
| 10 | return this._client.search(query); |
| 11 | } else if (!params) { |
| 12 | // if no params |
| 13 | return this.accessIndex(query.indexName).search(query.query); |
| 14 | } else { |
| 15 | // if params and callback |
| 16 | return this.accessIndex(query.indexName).search(query.query, params); |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | accessIndex(IndexName) { |
| 22 | if (!this._indices[IndexName]) { |