File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
sdk/search/search-documents Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ const client = new SearchClient(
103103
104104async function main () {
105105 // Let's get the top 5 jobs related to Microsoft
106- const searchResults = await client .search ({ searchText : " Microsoft" , top: 5 });
106+ const searchResults = await client .search (" Microsoft" , { top: 5 });
107107 for await (const result of searchResults .results ) {
108108 console .log (` ${ result .business_title } \n ${ result .job_description } \n ` );
109109 }
Original file line number Diff line number Diff line change @@ -21,13 +21,14 @@ async function main() {
2121 const credential = new AzureKeyCredential ( apiKey ) ;
2222 const client = new SearchClient ( endpoint , indexName , credential ) ;
2323
24- const count = await client . countDocuments ( ) ;
24+ const count = await client . getDocumentsCount ( ) ;
2525 console . log ( `${ count } documents in index ${ client . indexName } ` ) ;
2626
2727 const state = "FL" ;
2828 const country = "USA" ;
29- const searchResults = await client . search ( {
30- searchText : "WiFi" ,
29+ const searchResults = await client . search (
30+ "WiFi" ,
31+ {
3132 filter : odata `Address/StateProvince eq ${ state } and Address/Country eq ${ country } ` ,
3233 orderBy : [ "Rating desc" ] ,
3334 select : [ "HotelId" , "HotelName" , "Rating" ]
Original file line number Diff line number Diff line change @@ -51,13 +51,12 @@ export async function main() {
5151 const credential = new AzureKeyCredential ( apiKey ) ;
5252 const client = new SearchClient < Hotel > ( endpoint , indexName , credential ) ;
5353
54- const count = await client . countDocuments ( ) ;
54+ const count = await client . getDocumentsCount ( ) ;
5555 console . log ( `${ count } documents in index ${ client . indexName } ` ) ;
5656
5757 const state = "FL" ;
5858 const country = "USA" ;
59- const searchResults = await client . search ( {
60- searchText : "WiFi" ,
59+ const searchResults = await client . search ( "WiFi" , {
6160 filter : odata `Address/StateProvince eq ${ state } and Address/Country eq ${ country } ` ,
6261 orderBy : [ "Rating desc" ] ,
6362 select : [ "HotelId" , "HotelName" , "Rating" ]
You can’t perform that action at this time.
0 commit comments