You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-50Lines changed: 7 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,13 @@
3
3
4
4
This code sample builds a web site on Azure to search through a catalog of books. Searchable content is indexed and queried on Azure AI Search, and a static web app provides the search experience.
5
5
6
-
This sample includes two programs and an Azure function.
6
+
This C# sample includes two programs and an Azure function.
7
7
8
8
| components | Description |
9
9
|---------|-------------|
10
-
| bulk-insert app | Creates and loads the "goodbooks" index on Azure AI Search. It demonstrates index creation and batch mode indexing. Sample data is loaded from the [azure-search-sample-data](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/good-books) repository. To run this program, you must have write permissions on Azure AI Search. <p>This program is available in three languages: <br>/dotnet/bulk-insert <br>/python/bulk-insert <br>/javascript/bulk-insert|
10
+
| bulk-insert app | Creates and loads the "goodbooks" index on Azure AI Search. It demonstrates index creation and batch mode indexing. Sample data is loaded from the [azure-search-sample-data](https://github.com/Azure-Samples/azure-search-sample-data/tree/main/good-books) repository.|
11
11
| client app | Provides the client code. The web front-end includes a search page with faceted navigation, a search bar for free form search and suggested queries, and tabbed page results. It's written in JavaScript, uses Node.js for the runtime, and uses React libraries for user interaction. |
12
-
| api | Provides the Azure function used by the client to send queries to the search index. <p>The function is available in three languages: <br>/dotnet/api (.NET) <br>/python/api <br>/javascript/api |
12
+
| api | Provides the Azure function used by the client to send queries to the search index. |
13
13
14
14
This README is an shortened version of the [full tutorial](https://aka.ms/search-website-tutorial) and provides just the steps for running the sample. For more information and screenshots, see the tutorial.
15
15
@@ -24,9 +24,7 @@ This README is an shortened version of the [full tutorial](https://aka.ms/search
24
24
25
25
You should also have the Visual Studio code extension for the language used for building the index:
26
26
27
-
*[Python extension for Visual Studio Code](https://code.visualstudio.com/docs/languages/python) and a recent version of Python.
28
-
*[JavaScript extensions for VS Code](https://code.visualstudio.com/docs/nodejs/extensions).
29
-
*[Using .NET in Visual Studio Code](https://code.visualstudio.com/docs/languages/dotnet) and a recent of the .NET SDK.
27
+
*[Using .NET in Visual Studio Code](https://code.visualstudio.com/docs/languages/dotnet) and a recent of the .NET SDK
30
28
31
29
## Download sample repository
32
30
@@ -42,32 +40,22 @@ You should also have the Visual Studio code extension for the language used for
42
40
43
41
## Run Bulk Insert
44
42
45
-
Use any one of the following language versions to build the good-books index. Instructions are provided inindividual readme files. All of these programs assume Visual Studio Code as the IDE with the appropriate language extensions and executables.
43
+
Build the good-books index using the instructions provided inthe readme.To run this program, you need the search endpoint and [API keys](https://learn.microsoft.com/azure/search/search-security-api-keys#find-existing-keys). You can find this information in the Azure portal.
To run any of these programs, you need the search endpoint and [API keys](https://learn.microsoft.com/azure/search/search-security-api-keys#find-existing-keys). You can find this information in the Azure portal.
45
+
* [bulk-insert/readme](/bulk-insert/readme.md)
54
46
55
47
## Deploy the static web app
56
48
57
49
Once you have the good-books index on Azure AI Search, you can deploy a static web app as your search client.
58
50
59
-
Deploy the app from Visual Studio Code using the **Create Static Web App (Advanced)** wizard. In the wizard, you are prompted to set the location of your application code. This is the "language-of-choice"/api folder containing the Azure function, usingformaking calls to Azure AI Search.
51
+
Deploy the app from Visual Studio Code using the **Create Static Web App (Advanced)** wizard. In the wizard, you are prompted to set the location of your static web app sourcecode. This is the "client" folder. This project uses the default "api" folderforthe Azure function. The wizard assumes the default location.
60
52
61
53
1. In Visual Studio Code in Explorer, make sure you're at the repository root, and not the bulk-insert folder (for example, `azure-search-static-web-app`).
62
54
63
55
1. Select **Azure** from the Activity Bar, then open **Resources** from the side bar.
64
56
65
57
1. Right-click **Static Web Apps** and then select **Create Static Web App (Advanced)**. If you don't see this option, verify that you have the Azure Functions extension for Visual Studio Code.
66
58
67
-
1. If you see a pop-up window in Visual Studio Code asking which branch you want to deploy from, selectthe default branch, usually **main**.
68
-
69
-
This setting means only changes you commit to that branch are deployed to your static web app.
70
-
71
59
1. If you see a pop-up window asking you to commit your changes, don't do this. The secrets from the bulk import step shouldn't be committed to the repository.
72
60
73
61
To roll back the changes, open an integrated terminal window and type`git checkout .` to undo the commit.
@@ -82,7 +70,6 @@ Deploy the app from Visual Studio Code using the **Create Static Web App (Advanc
|Select the location of your client application code |`client` (no leading forward slash) <br><br>This is the path, from the root of the repository, to your static web app. |
85
-
|Select the location of your functioncode|`dotnet\api`, forexample.<br><br>Azure functions are providedin three languages. You can choose any one of them. |
86
73
|Enter the path of your build output... |`build`<br><br>This is the path, from your static web app, to your generated files.|
87
74
88
75
If you get an error about an incorrect region, make sure the resource group and static web app resource are in one of the supported regions listed in the error response.
@@ -94,36 +81,6 @@ Deploy the app from Visual Studio Code using the **Create Static Web App (Advanc
94
81
* Select **Open Actions in GitHub** from the Notifications. This opens a browser window pointed to your forked repo.
95
82
* Select the **Actions** tab in your forked repository. You should see a list of all workflows on your fork.
96
83
97
-
It's expected that the workflow succeeds. However, the Git workflow builds the YML file using a backward slash file delimiter, resulting in an invalid path for locating the API folder. Inside theBuild and Deploy Job output, you'll find a warning similar to this: "`[WARNING] Api Directory Location: 'javascriptpi' could not be found. Azure Functions will not be created. Either no Api directory was specified, or the specified directory was not found. Azure Functions will not be created.`".
98
-
99
-
1. Edit the YML to change the backward slash to a forward slash. You can perform this step as soon as the YML file is created. A new workflow launches as soon as you push the updates.
100
-
101
-
1. In Visual Studio Code explorer, open the `./.github/workflows/` directory.
102
-
103
-
1. Open the YML file.
104
-
105
-
1. Scroll to the `api-location` path (on or near line 31).
106
-
107
-
1. Replace the backslash (`dotnet\api`) with a forward slash (`dotnet/api`). This is the only line that needs editing, other locations are here for context:
108
-
109
-
```yml
110
-
app_location: "client"# App source code path
111
-
api_location: "dotnet/api" # Api source code path - optional
112
-
output_location: "build" # Built app content directory - optional
113
-
```
114
-
115
-
1. Save the file.
116
-
117
-
1. Open an integrated terminal and issue the following GitHub commands to send the updated YML to your fork:
118
-
119
-
```bash
120
-
git add -A
121
-
git commit -m "fix path"
122
-
git push origin main
123
-
```
124
-
125
-
Wait until the workflow execution completes before continuing. This may take a minute or two to finish.
126
-
127
84
## Get the Azure AI Search query key in Visual Studio Code
128
85
129
86
1. In Visual Studio Code, open a new terminal window.
Copy file name to clipboardExpand all lines: bulk-insert/readme.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,16 @@
2
2
3
3
1. Check your search service to make sure you have room for an extra index. The Usage tab in the Azure portal's search service page provides this information. The maximum limit on the free tier is 3 indexes. The maximum limit on the basic tier is 15 indexes.
4
4
5
+
1. Check your search service to make sure it allows API keys. API key settings can be found in the **Settings > Keys** page in the Azure portal's search service page.
6
+
5
7
1. Change the following values in the `Program.cs` file:
6
8
7
9
* YOUR-SEARCH-RESOURCE-NAME (not the full URL)
8
10
* YOUR-SEARCH-ADMIN-KEY
9
11
10
12
1. Open an integrated terminal in Visual Studio Code.
11
13
12
-
1. Make sure the path is "azure-search-static-web-app/dotnet/bulk-insert".
14
+
1. Make sure the path is "azure-search-static-web-app/bulk-insert".
0 commit comments