Wingene
Microsoft Azure 認知搜尋(Cognitive Search)是 Azure 的 AI 搜尋服務,允許開發人員在雲端應用程式中加入全文搜尋能力。此服務除了基本的全文搜尋,還包括許多進階功能,例如過濾、排序、分頁、語義搜尋等。更重要的是,Cognitive Search 支援 "cognitive skills",讓開發者可以應用 AI 技術(例如視覺和自然語言處理)來分析和理解他們的資料。
以下是 Azure Cognitive Search 的主要功能:
在應用端,Azure Cognitive Search 廣泛應用於網站搜尋、電子商務平台、文件探索和分析、資訊檢索等場景,提供了靈活且強大的搜尋功能,並結合 AI 的能力進一步提升使用者的搜尋體驗。
雖然現在(2023/05/24)還不支援向量搜尋(vector search),但是在 Microsoft 近日發表的新聞 https://news.microsoft.com/build-2023-book-of-news/ 中,則明確提到了之後會支援。
一開始進入 Azure 時,你會看到以下畫面。而我們要做的,首先就是建立一個伺服器。
我們應該要做的就是建立一個 SQL server,你可以依照自己的需求建立。
建立時,會需要填寫:
要記得,之後要填寫使用者名稱跟密碼時要紀錄起來,因為之後在我們上傳資料時會需要填寫,然後才能成功把資料傳到資料庫中的表。
在這裡,我建立的伺服器名稱就是 claybotserver。
這就是伺服器建立好的樣子。
接下來就是建立資料庫了。
建立資料庫同樣很單純,選擇自己想要的設定,唯一要注意的就是要把資料庫託管在自己剛剛建立的伺服氣上。
接著就是把我們的資料上傳上去了。
我是參考這個網站的:https://freegistutorial.com/how-to-import-csv-to-sql-server-using-azure-data-studio/
首先,下載 Azure Data Studio:https://learn.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver16&tabs=redhat-install%2Credhat-uninstall
打開後會要求要連線至遠端伺服器,這裡要輸入伺服器的 URI 和使用者名稱、密碼。記得是輸入伺服器的。
並且推薦一個好用的 extension(話說這界面跟功能和 VS Code 真的超像的):SQL Server Import。
接著對你的資料庫點擊右鍵,選擇 Import wizard,。
file:///home/clay/Pictures/Screenshots/Screenshot%20from%202023-05-24%2016-13-59.png
你會看到以下畫面,前面都可以不動,但是要匯入的文件要記得點選,基本上 csv 跟 json 都可以。
我的資料是測試資料 test.csv:
ID | DATE | VAL |
---|---|---|
0 | 20220522 | 68.2 |
1 | 20220523 | 50.3 |
2 | 20230503 | 77.9 |
這裡可以更改欄位名稱和資料型態之類的設定。
接著我們還要做一個情感搜尋(cognitive search)的服務。
老樣子,取名、設定地區… 等等的設定必須完成。
從 Import data 那邊匯入資料。
import os
from azure.core.credentials import AzureKeyCredential
from azure.search.documents import SearchClient
index_name = "clayrentalcar-index"
# Get the service endpoint and API key from the environment
endpoint = "https://irsystem.search.windows.net"
key = "hfGXwX5BOvSWwLRKhwnNh5Ed2AydQUDPjTgFUrOUCHAzSeAGR81x"
# Create a client
credential = AzureKeyCredential(key)
search_client = SearchClient(
endpoint=endpoint,
index_name=index_name,
credential=credential,
)
results = search_client.search(search_text="我想要租車")
for result in results:
print(result)
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing