File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed
playground/javascript/node Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change 1
- import {
2
- BrowseResponse ,
3
- Rule ,
4
- searchClient ,
5
- SearchRulesResponse ,
6
- SearchSynonymsResponse ,
7
- } from '@algolia/client-search' ;
8
- import { ApiError , createIterablePromise } from '@algolia/client-common' ;
1
+ import { searchClient } from '@algolia/client-search' ;
2
+ import { ApiError } from '@algolia/client-common' ;
9
3
import dotenv from 'dotenv' ;
10
4
11
5
dotenv . config ( { path : '../../.env' } ) ;
@@ -23,15 +17,9 @@ client.addAlgoliaAgent('Node playground', '0.0.1');
23
17
24
18
async function testSearch ( ) {
25
19
try {
26
- const records : Record < string , any > = [ ] ;
20
+ const res = await client . search < { name : string } > ( { requests : [ { indexName : searchIndex , query : searchQuery } ] } ) ;
27
21
28
- await client . browseObjects ( {
29
- indexName : 'gatsbyjs' ,
30
-
31
- aggregator : ( response ) => records . push ( ...response . hits ) ,
32
- } ) ;
33
-
34
- console . log ( records , records . length ) ;
22
+ console . log ( `[OK]` , res . results [ 0 ] . hits ! [ 0 ] . name ) ;
35
23
} catch ( e : any ) {
36
24
// Instance of
37
25
if ( e instanceof ApiError ) {
You can’t perform that action at this time.
0 commit comments