1+ // <Search_dependencies>
12import { SearchClient , SearchDocumentsResult , VectorQuery , SearchOptions , SearchResult , AzureKeyCredential } from "@azure/search-documents" ;
23import { vector } from "./queryVector.js" ;
34import { HotelDocument , indexName , searchEndpoint } from "./manageIndex.js" ;
@@ -15,7 +16,9 @@ const searchClient = new SearchClient<HotelDocument>(
1516 indexName ,
1617 new DefaultAzureCredential ( )
1718) ;
19+ // </Search_dependencies>
1820
21+ // <Search_singleVectorSearch>
1922export async function singleVectorSearch ( ) : Promise < void > {
2023 try {
2124
@@ -52,7 +55,8 @@ export async function singleVectorSearch(): Promise<void> {
5255 throw ex ;
5356 }
5457}
55-
58+ // </Search_singleVectorSearch>
59+ // <Search_singleVectorSearchWithFilter>
5660export async function singleVectorSearchWithFilter ( ) : Promise < void > {
5761 try {
5862
@@ -77,7 +81,7 @@ export async function singleVectorSearchWithFilter(): Promise<void> {
7781 } ;
7882 const results : SearchDocumentsResult < HotelDocument > = await searchClient . search ( "*" , searchOptions ) ;
7983
80- console . log ( `\n\nSingle Vector search with filter found ${ results . count } then limited to top ${ searchOptions . top } ` ) ;
84+ console . log ( `\n\nSingle Vector search with filter found ${ results . count } ` ) ;
8185
8286 for await ( const result of results . results ) {
8387 // Log each result
@@ -90,7 +94,8 @@ export async function singleVectorSearchWithFilter(): Promise<void> {
9094 throw ex ;
9195 }
9296}
93-
97+ // </Search_singleVectorSearchWithFilter>
98+ // <Search_vectorQueryWithGeoFilter>
9499export async function vectorQueryWithGeoFilter ( ) : Promise < void > {
95100 try {
96101
@@ -117,7 +122,7 @@ export async function vectorQueryWithGeoFilter(): Promise<void> {
117122 } ;
118123 const results : SearchDocumentsResult < HotelDocument > = await searchClient . search ( "*" , searchOptions ) ;
119124
120- console . log ( `\n\nVector search with geo filter found ${ results . count } then limited to top ${ searchOptions . top } ` ) ;
125+ console . log ( `\n\nVector search with geo filter found ${ results . count } ` ) ;
121126
122127 for await ( const result of results . results ) {
123128
@@ -142,8 +147,8 @@ export async function vectorQueryWithGeoFilter(): Promise<void> {
142147 throw ex ;
143148 }
144149}
145-
146-
150+ // </Search_vectorQueryWithGeoFilter>
151+ // <Search_hybridSearch>
147152export async function hybridSearch ( ) : Promise < void > {
148153
149154 try {
@@ -193,6 +198,8 @@ export async function hybridSearch(): Promise<void> {
193198 }
194199
195200}
201+ // </Search_hybridSearch>
202+ // <Search_semanticHybridSearch>
196203export async function semanticHybridSearch ( ) : Promise < void > {
197204
198205 try {
@@ -247,4 +254,5 @@ export async function semanticHybridSearch(): Promise<void> {
247254 console . error ( "Semantic hybrid search failed:" , ex ) ;
248255 throw ex ;
249256 }
250- }
257+ }
258+ // </Search_semanticHybridSearch>
0 commit comments