Skip to content

Commit 4fe45f0

Browse files
committed
JS versions
1 parent 93053ce commit 4fe45f0

File tree

13 files changed

+956
-225
lines changed

13 files changed

+956
-225
lines changed

.github/copilot-instructions.md

Lines changed: 0 additions & 222 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Azure AI Search Semantic Ranking Quickstart - JavaScript
2+
3+
This JavaScript sample demonstrates how to use semantic ranking in Azure AI Search to improve search relevance using machine reading comprehension. This is a JavaScript version of the [official Python quickstart](https://learn.microsoft.com/en-us/azure/search/search-get-started-semantic).
4+
5+
The sample has been refactored into a modular structure, with separate files for different operations.
6+
7+
## What is Semantic Ranking?
8+
9+
Semantic ranking uses machine reading comprehension from Microsoft to rescore search results, promoting the most semantically relevant matches to the top of the list. Unlike traditional keyword-based BM25 scoring, semantic ranking understands context and meaning.
10+
11+
## Prerequisites
12+
13+
- An Azure account with an active subscription
14+
- An Azure AI Search service (Basic tier or higher) with semantic ranker enabled
15+
- Node.js 18+ and npm
16+
17+
## Setup
18+
19+
1. **Clone or navigate to this directory**
20+
21+
2. **Install dependencies**
22+
```bash
23+
npm install
24+
```
25+
26+
3. **Configure your search service**
27+
- Copy `sample.env` to `.env`
28+
- Update the values with your Azure AI Search service details:
29+
```
30+
SEARCH_ENDPOINT=https://your-service-name.search.windows.net
31+
SEARCH_API_KEY=your-admin-api-key
32+
INDEX_NAME=hotels-quickstart
33+
```
34+
35+
4. **Get your search service endpoint and API key**
36+
- Sign in to the [Azure portal](https://portal.azure.com/)
37+
- Find your search service
38+
- Copy the URL from the Overview page
39+
- Copy an admin key from the Keys page
40+
41+
## Run the Sample
42+
43+
### Getting Index Settings
44+
```bash
45+
npm run get-index-settings
46+
```
47+
48+
### Updating Index Settings for Semantic Search
49+
```bash
50+
npm run update-index-settings
51+
```
52+
53+
### Run Semantic Queries
54+
```bash
55+
npm run get-semantic-query
56+
```
57+
58+
### Get Captions with Results
59+
```bash
60+
npm run get-captions
61+
```
62+
63+
### Get Semantic Answers
64+
```bash
65+
npm run get-answers
66+
```

0 commit comments

Comments
 (0)