File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env/node
2-
3- const hotelData = require ( "hotels.json" ) ;
4- const indexDefinition = require ( "hotels_quickstart_index.json" ) ;
5-
62const nconf = require ( 'nconf' ) ;
7- const AzureSearchClient = require ( './AzureSearchClient.js' ) ;
83
9- function getAzureConfiguration ( ) {
10- const config = nconf . file ( { file : 'azure_search_config.json' } ) ;
11- if ( config . get ( 'serviceName' ) == '[SEARCH_SERVICE_NAME' || config . get ( 'adminKey' ) == '[SEARCH_SERVICE_API_KEY]' ) {
12- throw new Error ( "You have not set the values in your azure_search_config.json file. Please change them to match your search service's values." ) ;
13- }
14- return config ;
15- }
4+ const hotelData = require ( './hotels.json' ) ;
5+ const indexDefinition = require ( './hotels_quickstart_index.json' ) ;
6+ const AzureSearchClient = require ( './AzureSearchClient.js' ) ;
167
178const queries = [
189 "*&$count=true" ,
1910 "historic&$filter=Rating gt 4&"
2011] ;
2112
22-
13+ function getAzureConfiguration ( ) {
14+ const config = nconf . file ( { file : 'azure_search_config.json' } ) ;
15+ if ( config . get ( 'serviceName' ) === '[SEARCH_SERVICE_NAME' ) {
16+ throw new Error ( "You have not set the values in your azure_search_config.json file.Change them to match your search service's values." ) ;
17+ }
18+ return config ;
19+ }
2320
2421function sleep ( ms )
2522{
@@ -50,7 +47,6 @@ const run = async () => {
5047 await exists ? client . deleteIndexAsync ( ) : Promise . resolve ( ) ;
5148 // Deleting index can take a few seconds
5249 await sleep ( 2000 ) ;
53- const indexDefinition = require ( './hotels_quickstart_index.json' ) ;
5450 await client . createIndexAsync ( indexDefinition ) ;
5551 // Index availability can take a few seconds
5652 await sleep ( 2000 ) ;
You can’t perform that action at this time.
0 commit comments