Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 12 additions & 43 deletions quickstart-keyword-search/README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,33 @@
---
page_type: sample
languages:
- java
- java
name: "Quickstart: Keyword search in Azure AI Search using Java"
description: |
Learn how to create, load, and query an Azure AI Search index using the Azure SDK for Java.
products:
- azure
- azure-cognitive-search
- azure
- azure-cognitive-search
urlFragment: java-quickstart-keyword
---

# Quickstart: Keyword search in Azure AI Search using Java

![Flask sample MIT license badge](https://img.shields.io/badge/license-MIT-green.svg)

Learn how to create, load, and query a search index on Azure AI Search using Java and the [com.azure:azure-search-documents](https://search.maven.org/artifact/com.azure/azure-search-documents) package.
This sample demonstrates the fundamentals of creating, loading, and querying a search index for full-text search, also known as keyword search. The index is modeled on a subset of the hotels dataset, which has been reduced for readability and comprehension.

To run this sample, follow the step-by-step instructions in [Quickstart: Full-text search](https://learn.microsoft.com/azure/search/search-get-started-text?pivots=java).
## What's in this sample

## Prerequisites
| File | Description |
|------|-------------|
| `pom.xml` | Project file that defines dependencies and build settings |
| `App.java` | Creates an index, loads documents, and runs queries |
| `Hotel.java`, `Address.java` | Model classes defining the index schema |

- Azure AI Search. You can [create a search service in the portal](https://docs.microsoft.com/azure/search/search-create-service-portal).
## Documentation

- Install a Java SDK. This sample was tested on the [Microsoft Build of OpenJDK](https://learn.microsoft.com/java/openjdk/install).

- Choose a strategy for building and running the project using [Maven](https://maven.apache.org/). This sample was tested using [Visual Studio Code](https://code.visualstudio.com/) with the [Java extension](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack).

## Set up the sample

1. Clone or download this sample repository.

1. Extract contents if the download is a ZIP file. Make sure the files are read-write.

1. Get the name of your search service. You can find the URL on the search service **Overview** page in the Azure portal.

1. Make sure you have permissions to create, load, and query an index: **Search Service Contributor**, **Search Index Data Contributor**, and **Search Index Data Reader**.

1. Run `az login` to sign in to your Azure account using the Azure CLI.

1. In Visual Studio Code or another IDE, create a Java project.

- Press Ctrl-Shift-P to open the command palette.
- Search for and then select **Java: Create Java Project**.
- Select **No Build**.

1. Open **App.java** and configure access to the search service by editing the variable for `searchServiceEndpoint`.

## Run the sample

1. In Visual Studio Code, press F5 to rebuild the app and run the program in its entirety.

The console should show the Maven build and testing process and the output of program execution:

- Deletes an index of the same name, if one already exists.
- Creates an index.
- Loads the index with four hotel documents.
- Executes several queries.

Finally, the Maven process should exit with a success message.
This sample accompanies [Quickstart: Full-text search using Java](https://learn.microsoft.com/azure/search/search-get-started-text?pivots=java). Follow the documentation for prerequisites, setup instructions, and detailed explanations.

## Next step

Expand Down
27 changes: 20 additions & 7 deletions quickstart-semantic-ranking/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
---
page_type: sample
languages:
- java
- java
name: "Quickstart: Semantic ranking in Azure AI Search using Java"
description: |
Demonstrates semantic ranking capabilities to improve search relevance using Azure AI Search.
products:
- azure
- azure-cognitive-search
- azure
- azure-cognitive-search
urlFragment: java-semantic-ranking-quickstart
---

# Quickstart: Semantic ranking in Azure AI Search using Java

![Flask sample MIT license badge](https://img.shields.io/badge/license-MIT-green.svg)

Semantic ranking capabilities to improve search relevance using Azure AI Search. This Java sample demonstrates how to create an index with a semantic configuration, upload documents to the index, and execute queries with semantic ranking to get improved relevance scoring and semantic captions. Requires a search service on the Standard pricing tier or higher with semantic ranking enabled.
This sample demonstrates how to set up semantic ranking. You add a semantic configuration to a search index, and then you add semantic parameters to a query.

This sample is built on the [Microsoft Build of OpenJDK](https://learn.microsoft.com/java/openjdk/install) using the [Maven](https://maven.apache.org/) build system. This sample has dependencies on the [Azure AI Search](https://search.maven.org/artifact/com.azure/azure-search-documents) and [Azure Identity](https://search.maven.org/artifact/com.azure/azure-identity) client libraries.
## What's in this sample

To run this sample, follow the step-by-step instructions in [Quickstart: Semantic ranking](https://learn.microsoft.com/azure/search/search-get-started-semantic?pivots=java).
| File | Description |
|------|-------------|
| `pom.xml` | Project file that defines dependencies and build settings |
| `application.properties` | Configuration file for search service endpoint |
| `SearchConfig.java` | Configuration class for search service connection |
| `GetIndexSettings.java` | Retrieves index schema and semantic configuration |
| `UpdateIndexSettings.java` | Adds semantic configuration to an index |
| `SemanticQuery.java` | Runs basic semantic ranking queries |
| `SemanticQueryWithCaptions.java` | Runs semantic queries with captions and highlights |
| `SemanticAnswer.java` | Returns semantic answers from query results |

## Documentation

This sample accompanies [Quickstart: Semantic ranking using Java](https://learn.microsoft.com/azure/search/search-get-started-semantic?pivots=java). Follow the documentation for prerequisites, setup instructions, and detailed explanations.

## Next step

You can learn more about Azure AI Search and semantic ranking on the [official documentation site](https://learn.microsoft.com/azure/search) and [semantic ranking overview](https://learn.microsoft.com/azure/search/semantic-search-overview).
You can learn more about Azure AI Search on the [official documentation site](https://learn.microsoft.com/azure/search).
26 changes: 19 additions & 7 deletions quickstart-vector-search/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
---
page_type: sample
languages:
- java
- java
name: "Quickstart: Vector search in Azure AI Search using Java"
description: |
Demonstrates vector search capabilities using Azure AI Search with HNSW algorithm.
products:
- azure
- azure-cognitive-search
- azure
- azure-cognitive-search
urlFragment: java-vector-quickstart
---

# Quickstart: Vector search in Azure AI Search using Java

![Flask sample MIT license badge](https://img.shields.io/badge/license-MIT-green.svg)

Vector search capabilities using Azure AI Search with the HNSW algorithm. This Java sample demonstrates how to create an index with vector field configurations, upload documents with pre-computed embeddings to the index, and execute vector similarity searches and hybrid queries. Requires a search service on any pricing tier, though Basic or higher is recommended for larger data files.
This sample demonstrates the fundamentals of vector search, including creating a vector index, loading documents with embeddings, and running vector and hybrid queries.

This sample is built on Java 21 (LTS) from the [Microsoft Build of OpenJDK](https://learn.microsoft.com/java/openjdk/install) using the [Maven](https://maven.apache.org/) build system. This sample has dependencies on the [Azure AI Search](https://search.maven.org/artifact/com.azure/azure-search-documents) and [Azure Identity](https://search.maven.org/artifact/com.azure/azure-identity) client libraries.
## What's in this sample

To run this sample, follow the step-by-step instructions in [Quickstart: Vector search](https://learn.microsoft.com/azure/search/search-get-started-vector?tabs=keyless&pivots=java).
| File | Description |
|------|-------------|
| `pom.xml` | Project file that defines dependencies and build settings |
| `application.properties` | Configuration file for search service endpoint |
| `CreateIndex.java` | Creates a search index with vector field configurations |
| `DeleteIndex.java` | Deletes an existing search index |
| `UploadDocuments.java` | Uploads documents with precomputed embeddings |
| `QueryVector.java` | Precomputed sample query vector |
| `Search*.java` | Runs vector, hybrid, and semantic hybrid queries |

## Documentation

This sample accompanies [Quickstart: Vector search using Java](https://learn.microsoft.com/azure/search/search-get-started-vector?pivots=java). Follow the documentation for prerequisites, setup instructions, and detailed explanations.

## Next step

You can learn more about Azure AI Search and vector search on the [official documentation site](https://learn.microsoft.com/azure/search) and [vector search overview](https://learn.microsoft.com/azure/search/vector-search-overview).
You can learn more about Azure AI Search on the [official documentation site](https://learn.microsoft.com/azure/search).