Skip to content

Commit b9ff24c

Browse files
committed
addressing feedback
1 parent 2eb4180 commit b9ff24c

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

articles/search/search-get-started-java.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ ms.custom: devx-track-java, mode-api
2222
> * [Python](search-get-started-python.md)
2323
> * [REST](search-get-started-rest.md)
2424
25-
Create a Java console application that creates, loads, and queries a search index using [Visual Studio Code](https://code.visualstudio.com/), [Java 11 SDK](/java/azure/jdk/), and the [Azure Cognitive Search REST API](/rest/api/searchservice/). This article provides step-by-step instructions for creating the application. Alternatively, you can [download and run the complete application](https://github.com/Azure-Samples/azure-search-java-samples).
25+
Create a Java console application that creates, loads, and queries a search index using [Visual Studio Code](https://code.visualstudio.com/), [Java 11 SDK](/java/azure/jdk/), and the [Azure.Search.Documents client library in the Azure SDK for Java.](/java/api/overview/azure/search). This article provides step-by-step instructions for creating the application. Alternatively, you can [download and run the complete application](https://github.com/Azure-Samples/azure-search-java-samples).
2626

2727
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
2828

2929
## Prerequisites
3030

3131
We used the following software and services to build and test this quickstart:
3232

33-
+ [Visual Studio Code](https://www.jetbrains.com/idea/)
33+
+ [Visual Studio Code](https://code.visualstudio.com/)
34+
35+
+ [Java extension for Visual Studio Code](https://vscode.trafficmanager.net/docs/java/extensions)
3436

3537
+ [Java 11 SDK](/java/azure/jdk/)
3638

@@ -52,12 +54,12 @@ Every request sent to your service requires an API key. Having a valid key estab
5254

5355
## Set up your environment
5456

55-
Begin by opening Visual Studio Code and setting up a new project
57+
Begin by opening Visual Studio Code and setting up a new project.
5658

5759
### Create the project
5860

59-
1. Open Visual Studio Code
60-
1. Install the [Extension Pack For Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack)
61+
1. Open Visual Studio Code.
62+
1. Install the [Extension Pack For Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack).
6163
1. Open the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) **Ctrl+Shift+P**. Search for **Create Java Project**.
6264

6365
:::image type="content" source="media/search-get-started-java/java-quickstart-create-project.png" alt-text="Screenshot of a create a java project." border="true":::
@@ -84,7 +86,7 @@ Begin by opening Visual Studio Code and setting up a new project
8486

8587
1. Select the folder to create the project in.
8688

87-
1. Finish project creation in the [terminal](https://code.visualstudio.com/docs/terminal/basics). Press enter, then type **y** and press enter again
89+
1. Finish project creation in the [integrated terminal](https://code.visualstudio.com/docs/terminal/basics). Press enter to accept the default for "1.0-SNAPSHOT" and then type "y" to confirm the properties for your project.
8890

8991
:::image type="content" source="media/search-get-started-java/java-quickstart-finish-setup-terminal.png" alt-text="Screenshot of a finish setup in terminal." border="true":::
9092

@@ -106,6 +108,12 @@ Begin by opening Visual Studio Code and setting up a new project
106108
<artifactId>azure-core</artifactId>
107109
<version>1.34.0</version>
108110
</dependency>
111+
<dependency>
112+
<groupId>junit</groupId>
113+
<artifactId>junit</artifactId>
114+
<version>4.11</version>
115+
<scope>test</scope>
116+
</dependency>
109117
</dependencies>
110118
```
111119

@@ -143,7 +151,7 @@ Begin by opening Visual Studio Code and setting up a new project
143151
import com.azure.search.documents.util.SearchPagedIterable;
144152
```
145153

146-
1. Create two clients: [SearchIndexClient](/java/api/com.azure.search.documents.indexes.searchindexclient) creates the index, and [SearchClient](/java/api/com.azure.search.documents.searchclient) loads and queries an existing index. Both need the service endpoint and an admin API key for authentication with create/delete rights.
154+
1. The following example includes placeholders for a search service name, admin API key that grants create and delete permissions, and index name. Substitute valid values for all three placeholders. Create two clients: [SearchIndexClient](/java/api/com.azure.search.documents.indexes.searchindexclient) creates the index, and [SearchClient](/java/api/com.azure.search.documents.searchclient) loads and queries an existing index. Both need the service endpoint and an admin API key for authentication with create and delete rights.
147155

148156

149157
```java
@@ -281,7 +289,7 @@ In this example, synchronous methods of the azure-search-documents library are u
281289
}
282290
```
283291

284-
In the azure-search-documents client library, you can use [SearchableField](/java/api/com.azure.search.documents.indexes.searchablefield) and [SimpleField](/java/api/com.azure.search.documents.indexes.simplefield) to streamline field definitions.
292+
In the Azure.Search.Documents client library, you can use [SearchableField](/java/api/com.azure.search.documents.indexes.searchablefield) and [SimpleField](/java/api/com.azure.search.documents.indexes.simplefield) to streamline field definitions.
285293

286294
* `SimpleField` can be any data type, is always non-searchable (it's ignored for full text search queries), and is retrievable (it's not hidden). Other attributes are off by default, but can be enabled. You might use a SimpleField for document IDs or fields used only in filters, facets, or scoring profiles. If so, be sure to apply any attributes that are necessary for the scenario, such as IsKey = true for a document ID.
287295
* `SearchableField` must be a string, and is always searchable and retrievable. Other attributes are off by default, but can be enabled. Because this field type is searchable, it supports synonyms and the full complement of analyzer properties.
@@ -611,21 +619,21 @@ The previous queries show multiple ways of matching terms in a query: full-text
611619

612620
Full text search and filters are performed using the [SearchClient.search](/java/api/com.azure.search.documents.searchclient#com-azure-search-documents-searchclient-search(java-lang-string)) method. A search query can be passed in the `searchText` string, while a filter expression can be passed in the `filter` property of the [SearchOptions](/java/api/com.azure.search.documents.models.searchoptions) class. To filter without searching, just pass "*" for the `searchText` parameter of the `search` method. To search without filtering, leave the `filter` property unset, or don't pass in a `SearchOptions` instance at all.
613621

614-
### Run the program
622+
## Run the program
615623

616624
Press F5 to rebuild the app and run the program in its entirety.
617625

618626
Output includes messages from System.out.println, with the addition of query information and results.
619627

620-
### Clean up resources
628+
## Clean up resources
621629

622630
When you're working in your own subscription, it's a good idea at the end of a project to identify whether you still need the resources you created. Resources left running can cost you money. You can delete resources individually or delete the resource group to delete the entire set of resources.
623631

624632
You can find and manage resources in the portal, using the **All resources** or **Resource groups** link in the left-navigation pane.
625633

626634
If you're using a free service, remember that you're limited to three indexes, indexers, and data sources. You can delete individual items in the portal to stay under the limit.
627635

628-
### Next Steps
636+
## Next Steps
629637

630638
In this Java quickstart, you worked through a set of tasks to create an index, load it with documents, and run queries. At different stages, we took shortcuts to simplify the code for readability and comprehension. Now that you're familiar with the basic concepts, try the next tutorial to call Cognitive Search APIs in the context of a web app.
631639

0 commit comments

Comments
 (0)