Skip to content

Commit 3bce8d9

Browse files
committed
full text quickstart in python
1 parent ae0549d commit 3bce8d9

File tree

3 files changed

+20
-49
lines changed

3 files changed

+20
-49
lines changed

articles/search/includes/quickstarts/full-text-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ AzureKeyCredential credential = new AzureKeyCredential("<Your search service adm
544544
545545
### Create index
546546
547-
The *hotels_quickstart_index.json* file defines how Azure AI Search works with the documents you'll be loading in the next step. Each field will be identified by a `name` and have a specified `type`. Each field also has a series of index attributes that specify whether Azure AI Search can search, filter, sort, and facet upon the field. Most of the fields are simple data types, but some, like `AddressType` are complex types that allow you to create rich data structures in your index. You can read more about [supported data types](/rest/api/searchservice/supported-data-types) and index attributes described in [Create Index (REST)](/rest/api/searchservice/indexes/create).
547+
The *hotels_quickstart_index.json* file defines how Azure AI Search works with the documents you load in the next step. Each field is identified by a `name` and have a specified `type`. Each field also has a series of index attributes that specify whether Azure AI Search can search, filter, sort, and facet upon the field. Most of the fields are simple data types, but some, like `AddressType` are complex types that allow you to create rich data structures in your index. You can read more about [supported data types](/rest/api/searchservice/supported-data-types) and index attributes described in [Create Index (REST)](/rest/api/searchservice/indexes/create).
548548
549549
With our index definition in place, we want to import *hotels_quickstart_index.json* at the top of *index.js* so the main function can access the index definition.
550550

articles/search/includes/quickstarts/full-text-python.md

Lines changed: 18 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.date: 2/22/2025
1616

1717
- An active Azure subscription - <a href="https://azure.microsoft.com/free/cognitive-services" target="_blank">Create one for free</a>
1818
- An Azure AI Search service. [Create a service](../../search-create-service-portal.md) if you don't have one. You can use a free tier for this quickstart.
19-
- [Visual Studio Code with the Python extension](https://code.visualstudio.com/docs/languages/python), or an equivalent IDE, with Python 3.10 or later. If you don't have a suitable version of Python installed, you can follow the instructions in the [VS Code Python Tutorial](https://code.visualstudio.com/docs/python/python-tutorial#_install-a-python-interpreter) for the easiest way of installing Python on your operating system.
19+
- [Visual Studio Code with the Python extension](https://code.visualstudio.com/docs/languages/python), or an equivalent IDE, with Python 3.10 or later. If you don't have a suitable version of Python installed, you can follow the instructions in the [VS Code Python Tutorial](https://code.visualstudio.com/docs/python/python-tutorial#_install-a-python-interpreter).
2020

2121
## Microsoft Entra ID prerequisites
2222

@@ -77,13 +77,13 @@ You run the sample code in a Jupyter notebook. So, you need to set up your envir
7777
1. Select the notebook kernel.
7878
7979
1. In the top right corner of the notebook, select **Select Kernel**.
80-
1. If you see **.venv** in the list, select it. If you don't see it, select **Select Another Kernel** > **Python environments** > **.venv**.
80+
1. If you see `.venv` in the list, select it. If you don't see it, select **Select Another Kernel** > **Python environments** > `.venv`.
8181

8282
## Create, load, and query a search index
8383

8484
In this section, you add code to create a search index, load it with documents, and run queries. You run the program to see the results in the console. For a detailed explanation of the code, see the [explaining the code](#explaining-the-code) section.
8585

86-
1. Make sure the notebook is open in the **.venv** kernel as described in the previous section.
86+
1. Make sure the notebook is open in the `.venv` kernel as described in the previous section.
8787
1. Run the first code cell to install the required packages, including [azure-search-documents](/python/api/azure-search-documents).
8888

8989
```python
@@ -137,58 +137,29 @@ In this section, you add code to create a search index, load it with documents,
137137

138138
### Create an index
139139

140+
`SearchIndexClient` is used to create and manage indexes for Azure AI Search. Each field is identified by a `name` and has a specified `type`.
140141

142+
Each field also has a series of index attributes that specify whether Azure AI Search can search, filter, sort, and facet upon the field. Most of the fields are simple data types, but some, like `AddressType` are complex types that allow you to create rich data structures in your index. You can read more about [supported data types](/rest/api/searchservice/supported-data-types) and index attributes described in [Create Index (REST)](/rest/api/searchservice/indexes/create).
141143

142-
### Create a documents payload
144+
### Create a documents payload and upload documents
143145

144146
Use an [index action](/python/api/azure-search-documents/azure.search.documents.models.indexaction) for the operation type, such as upload or merge-and-upload. Documents originate from the [HotelsData](https://github.com/Azure-Samples/azure-search-sample-data/blob/main/hotels/HotelsData_toAzureSearch.JSON) sample on GitHub.
145147

148+
### Search an index
146149

147-
### Upload documents
148-
149-
Upload documents to the index
150-
151-
152-
### Run your first query
150+
You can get query results as soon as the first document is indexed, but actual testing of your index should wait until all documents are indexed.
153151

154152
Use the *search* method of the [search.client class](/python/api/azure-search-documents/azure.search.documents.searchclient).
155153

156-
This example executes an empty search (`search=*`), returning an unranked list (search score = 1.0) of arbitrary documents. Because there are no criteria, all documents are included in results.
157-
158-
159-
### Run a term query
160-
161-
The next query adds whole terms to the search expression ("wifi"). This query specifies that results contain only those fields in the `select` statement. Limiting the fields that come back minimizes the amount of data sent back over the wire and reduces search latency.
162-
163-
164-
### Add a filter
165-
166-
Add a filter expression, returning only those hotels with a rating greater than four, sorted in descending order.
167-
168-
169-
### Add field scoping
170-
171-
Add `search_fields` to scope query execution to specific fields.
172-
173-
174-
### Add facets
175-
176-
Facets are generated for positive matches found in search results. There are no zero matches. If search results don't include the term *wifi*, then *wifi* doesn't appear in the faceted navigation structure.
177-
178-
179-
### Look up a document
180-
181-
Return a document based on its key. This operation is useful if you want to provide drill through when a user selects an item in a search result.
182-
183-
184-
### Add autocomplete
185-
186-
Autocomplete can provide potential matches as the user types into the search box.
187-
188-
Autocomplete uses a suggester (`sg`) to know which fields contain potential matches to suggester requests. In this quickstart, those fields are `Tags`, `Address/City`, `Address/Country`.
189-
190-
To simulate autocomplete, pass in the letters *sa* as a partial string. The autocomplete method of [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) sends back potential term matches.
154+
The sample queries in the notebook are:
155+
- Basic query: Executes an empty search (`search=*`), returning an unranked list (search score = 1.0) of arbitrary documents. Because there are no criteria, all documents are included in results.
156+
- Term query: Adds whole terms to the search expression ("wifi"). This query specifies that results contain only those fields in the `select` statement. Limiting the fields that come back minimizes the amount of data sent back over the wire and reduces search latency.
157+
- Filtered query: Add a filter expression, returning only those hotels with a rating greater than four, sorted in descending order.
158+
- Fielded scoping: Add `search_fields` to scope query execution to specific fields.
159+
- Facets: Generate facets for positive matches found in search results. There are no zero matches. If search results don't include the term *wifi*, then *wifi* doesn't appear in the faceted navigation structure.
160+
- Look up a document: Return a document based on its key. This operation is useful if you want to provide drill through when a user selects an item in a search result.
161+
- Autocomplete: Provide potential matches as the user types into the search box. Autocomplete uses a suggester (`sg`) to know which fields contain potential matches to suggester requests. In this quickstart, those fields are `Tags`, `Address/City`, `Address/Country`. To simulate autocomplete, pass in the letters *sa* as a partial string. The autocomplete method of [SearchClient](/python/api/azure-search-documents/azure.search.documents.searchclient) sends back potential term matches.
191162

192-
## Remove the index
163+
### Remove the index
193164

194-
If you are finished with this index, you can delete it by running the **Clean up** code cell. Deleting unnecessary indexes frees up space for stepping through more quickstarts and tutorials.
165+
If you're finished with this index, you can delete it by running the **Clean up** code cell. Deleting unnecessary indexes frees up space for stepping through more quickstarts and tutorials.

articles/search/includes/quickstarts/full-text-typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ const credential = new AzureKeyCredential(apiKey);
472472
473473
### Create index
474474
475-
Create a file *hotels_quickstart_index.json*. This file defines how Azure AI Search works with the documents you'll be loading in the next step. Each field will be identified by a `name` and have a specified `type`. Each field also has a series of index attributes that specify whether Azure AI Search can search, filter, sort, and facet upon the field. Most of the fields are simple data types, but some, like `AddressType` are complex types that allow you to create rich data structures in your index. You can read more about [supported data types](/rest/api/searchservice/supported-data-types) and index attributes described in [Create Index (REST)](/rest/api/searchservice/indexes/create).
475+
Create a file *hotels_quickstart_index.json*. This file defines how Azure AI Search works with the documents you load in the next step. Each field is identified by a `name` and have a specified `type`. Each field also has a series of index attributes that specify whether Azure AI Search can search, filter, sort, and facet upon the field. Most of the fields are simple data types, but some, like `AddressType` are complex types that allow you to create rich data structures in your index. You can read more about [supported data types](/rest/api/searchservice/supported-data-types) and index attributes described in [Create Index (REST)](/rest/api/searchservice/indexes/create).
476476
477477
We want to import *hotels_quickstart_index.json* so the main function can access the index definition.
478478

0 commit comments

Comments
 (0)