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: articles/search/tutorial-csharp-create-first-app.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ To complete this tutorial, you need to:
51
51
1. Using Visual Studio, navigate to, and open the solution for the basic search page, and select **Start without debugging** (or press F5).
52
52
1. Type in some words (for example "wifi", "view", "bar", "parking"), and examine the results!
53
53
54
-

54
+

55
55
56
56
Hopefully this project will run smoothly, and you have Azure app running. Many of the essential components for more sophisticated searches are included in this one app, so it is a good idea to go through it, and recreate it step by step.
57
57
@@ -60,15 +60,15 @@ To create this project from scratch, and hence help reinforce the components of
60
60
## Set up a development environment
61
61
62
62
1. In Visual Studio 2017, or later, select **New/Project** then **ASP.NET Core Web Application**. Give the project a name such as "FirstAzureSearchApp".
63
-

63
+

64
64
65
65
2. After you have clicked **OK** for this project type, you will be given a second set of options that apply to this project. Select **Web Application (Model-View-Controller)**.
66
66
67
-

67
+

68
68
69
69
3. Next, in the **Tools** menu, select **NuGet Package Manager** and then **Manage NuGet Packages for Solution...**. There is one package we need to install. Select the **Browse** tab then type "Azure Search" into the search box. Install **Microsoft.Azure.Search** when it appears in the list (version 9.0.1, or later). You will have to click through a few additional dialogs to complete the installation.
70
70
71
-

71
+

72
72
73
73
### Initialize Azure Search
74
74
@@ -85,7 +85,7 @@ For this sample, we are using publicly available hotel data. This data is an arb
85
85
86
86
2. We are not done with this file yet, select the properties for this file, and change the **Copy to Output Directory** setting to **Copy if newer**.
87
87
88
-

88
+

1. Select **Debug/Start Without Debugging** or press the F5 key. If you have coded things correctly, you will get the initial Index view.
507
507
508
-

508
+

509
509
510
510
2. Enter text such as "beach" (or any text that comes to mind), and click the search icon. You should get some results.
511
511
512
-

512
+

513
513
514
514
3. Try entering "five star". Note how you get no results. A more sophisticated search would treat "five star" as a synonym for "luxury" and return those results. The use of synonyms is available in Azure Search, though we will not be covering it in the first tutorials.
515
515
@@ -525,7 +525,7 @@ It is important to verify that our error handling features work as they should,
525
525
526
526
2. Run the app, enter "bar" as search text, and click the search icon. The exception should result in the error view.
527
527
528
-

528
+

529
529
530
530
> [!Important]
531
531
> It is considered a security risk to return internal error numbers in error pages. If your app is intended for general use, do some investigation into secure and best practices of what to return when an error occurs.
Copy file name to clipboardExpand all lines: articles/search/tutorial-csharp-paging.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -364,19 +364,19 @@ Now select **Start Without Debugging** (or press the F5 key).
364
364
365
365
1. Search on some text that will give plenty of results (such as "wifi"). Can you page neatly through the results?
366
366
367
-

367
+

368
368
369
369
2. Try clicking on the right-most, and later, left-most page numbers. Do the page numbers adjust appropriately to center the page you are on?
370
370
371
371
3. Are the "first" and "last" options useful? Some popular web searches use these options, and others do not.
372
372
373
373
4. Go to the last page of results. The last page is the only page that may contain less than **ResultsPerPage** results.
374
374
375
-

375
+

376
376
377
377
5. Type in "town", and click search. No paging options are displayed if there are less than one page worth of results.
378
378
379
-

379
+

380
380
381
381
Now save off this project and let's try an alternative to this form of paging.
382
382
@@ -569,7 +569,7 @@ Now select **Start Without Debugging** (or press the F5 key).
569
569
570
570
1. Enter a term that will give plenty of results (such as "pool") and then test the vertical scroll bar. Does it trigger a new page of results?
571
571
572
-

572
+

573
573
574
574
> [!Tip]
575
575
> To ensure that a scroll bar appears on the first page, the first page of results must slightly exceed the height of the area they are being displayed in. In our example **.box1** has a height of 30 pixels, **.box2** has a height of 100 pixels _and_ a bottom margin of 24 pixels. So each entry uses 154 pixels. Three entries will take up 3 x 154 = 462 pixels. To ensure that a vertical scroll bar appears, a height to the display area must be set that is smaller than 462 pixels, even 461 works. This issue only occurs on the first page, after that a scroll bar is sure to appear. The line to update is: **<div id="myDiv" style="width: 800px; height: 450px; overflow-y: scroll;" onscroll="scrolled()">**.
@@ -53,7 +53,7 @@ The key here is that we have set the **id** of the search box to **azureautosugg
53
53
</script>
54
54
```
55
55
56
-
We have connected this script to the search box via the same id. Also, a minimum of two characters is needed to trigger the search, and we call the **Suggest** action in the home controller with two query parameters: **highlights** and **fuzzy**, both set to false in this instance.
56
+
We have connected this script to the search box via the same ID. Also, a minimum of two characters is needed to trigger the search, and we call the **Suggest** action in the home controller with two query parameters: **highlights** and **fuzzy**, both set to false in this instance.
57
57
58
58
### Add references to jquery scripts to the view
59
59
@@ -132,15 +132,15 @@ using System.Linq;
132
132
133
133
3. Run the app. Do you get a range of options when you enter "po", for example? Now try "pa".
134
134
135
-

135
+

136
136
137
137
Notice that the letters you enter _must_ start a word, and not simply be included within the word.
138
138
139
139
4. In the view script, set **&fuzzy** to true, and run the app again. Now enter "po". Notice that the search assumes you got one letter wrong!
140
140
141
-

141
+

142
142
143
-
If you are interested, the [Lucene query syntax in Azure Search](https://docs.microsoft.com/en-us/azure/search/query-lucene-syntax) describes the logic used in fuzzy searches in detail.
143
+
If you are interested, the [Lucene query syntax in Azure Search](https://docs.microsoft.com/azure/search/query-lucene-syntax) describes the logic used in fuzzy searches in detail.
144
144
145
145
## Add highlighting to the suggestions
146
146
@@ -175,15 +175,15 @@ We can improve the appearance of the suggestions to the user a bit, by setting t
175
175
</script>
176
176
```
177
177
178
-
2. Now change the id of the text box so it reads as follows.
178
+
2. Now change the ID of the text box so it reads as follows.
179
179
180
180
```cs
181
181
@Html.TextBoxFor(m=>m.searchText, new { @class="searchBox", @id="azuresuggesthighlights" }) <inputvalue=""class="searchBoxSubmit"type="submit">
@@ -208,7 +208,7 @@ Another variation, that is slightly different from suggestions, is autocompletio
208
208
</script>
209
209
```
210
210
211
-
2. Now change the **id** of the text box, so it reads as follows.
211
+
2. Now change the ID of the text box, so it reads as follows.
212
212
213
213
```cs
214
214
@Html.TextBoxFor(m=>m.searchText, new { @class="searchBox", @id="azureautocompletebasic" }) <inputvalue=""class="searchBoxSubmit"type="submit">
@@ -239,11 +239,11 @@ Another variation, that is slightly different from suggestions, is autocompletio
239
239
240
240
Notice that we are using the same *suggester* function, called "sg", in the autocomplete search as we did for suggestions (so we are only trying to autocomplete the hotel names).
241
241
242
-
There are a range of **AutocompleteMode** settings, and we are using **OneTermWithContext**. Refer to [Azure Autocomplete](https://docs.microsoft.com/en-us/rest/api/searchservice/autocomplete) for a description of the range of options here.
242
+
There are a range of **AutocompleteMode** settings, and we are using **OneTermWithContext**. Refer to [Azure Autocomplete](https://docs.microsoft.com/rest/api/searchservice/autocomplete) for a description of the range of options here.
243
243
244
244
4. Run the app. Notice how the range of options displayed in the drop-down list are single words. Try typing words starting with "re". Notice how the number of options reduces as more letters are typed.
245
245
246
-

246
+

247
247
248
248
As it stands, the suggestions script you ran earlier is probably more helpful than this autocompletion script. To make autocompletion more user-friendly, it is best added to the suggestion search.
249
249
@@ -315,7 +315,7 @@ One autocompletion option is returned at the top of the **results** list, follow
0 commit comments