Clay
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    ###### tags: `Wingene` # Microsoft Azure SQL 認知搜尋(Cognitive Search)筆記 ## 什麼是 Azure 認知搜尋 Microsoft Azure 認知搜尋(Cognitive Search)是 Azure 的 AI 搜尋服務,允許開發人員在雲端應用程式中加入全文搜尋能力。此服務除了基本的全文搜尋,還包括許多進階功能,例如過濾、排序、分頁、語義搜尋等。更重要的是,Cognitive Search 支援 "cognitive skills",讓開發者可以應用 AI 技術(例如視覺和自然語言處理)來分析和理解他們的資料。 以下是 Azure Cognitive Search 的主要功能: 1. **全文搜尋**:支援多語言和語義搜尋,使用者可以使用簡單的查詢語法進行複雜的搜尋。 2. **分析**:Cognitive Search 內建許多文本分析器,可以進行自然語言處理任務,例如斷詞、詞性標註、實體識別等。 3. Cognitive Skills:這些是預先建立的 AI 模型,可以用來提取和理解資料。例如,有一些 Cognitive Skills 可以分析圖像、提取關鍵字、識別語言等。 4. **索引**:Cognitive Search 可以對多種類型的資料源建立索引,包括 Azure SQL Database、Azure Cosmos DB、Azure Blob Storage 等。 5. **安全性與隱私**:Cognitive Search 支援 Azure 的安全和隱私標準,例如使用 SSL 加密連線、身分驗證等。 6. **可擴展性與可用性**:Cognitive Search 支援橫向擴展,可以根據負載自動調整容量。同時,服務也設計成可以應對硬體故障,確保高可用性。 在應用端,Azure Cognitive Search 廣泛應用於網站搜尋、電子商務平台、文件探索和分析、資訊檢索等場景,提供了靈活且強大的搜尋功能,並結合 AI 的能力進一步提升使用者的搜尋體驗。 雖然現在(2023/05/24)還不支援向量搜尋(vector search),但是在 Microsoft 近日發表的新聞 https://news.microsoft.com/build-2023-book-of-news/ 中,則明確提到了之後會支援。 ![](https://hackmd.io/_uploads/S191dVjS2.png) <br/> ## 建立伺服器 一開始進入 Azure 時,你會看到以下畫面。而我們要做的,首先就是建立一個伺服器。 ![](https://hackmd.io/_uploads/B1h01BiBn.png) 我們應該要做的就是建立一個 SQL server,你可以依照自己的需求建立。 ![](https://hackmd.io/_uploads/B177grjS3.png) 建立時,會需要填寫: - 訂閱戶(Subscription) - 資源群組(Resource group) - 伺服器名稱(Server name) - 位置(Location) 要記得,之後要填寫使用者名稱跟密碼時要紀錄起來,因為之後在我們上傳資料時會需要填寫,然後才能成功把資料傳到資料庫中的表。 在這裡,我建立的伺服器名稱就是 **claybotserver**。 這就是伺服器建立好的樣子。 ![](https://hackmd.io/_uploads/SkHIMSsHh.png) ## 建立資料庫 接下來就是建立資料庫了。 ![](https://hackmd.io/_uploads/S1FUVroS2.png) 建立資料庫同樣很單純,選擇自己想要的設定,唯一要注意的就是要把資料庫託管在自己剛剛建立的伺服氣上。 ## 匯入資料 接著就是把我們的資料上傳上去了。 我是參考這個網站的: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**。 ![](https://hackmd.io/_uploads/r1obDSjS3.png) 接著對你的資料庫點擊右鍵,選擇 Import wizard,。 file:///home/clay/Pictures/Screenshots/Screenshot%20from%202023-05-24%2016-13-59.png 你會看到以下畫面,前面都可以不動,但是要匯入的文件要記得點選,基本上 csv 跟 json 都可以。 ![](https://hackmd.io/_uploads/BJdFwBiBh.png) 我的資料是測試資料 **test.csv**: |ID|DATE|VAL| |:-:|:-:|:-:| |0|20220522|68.2| |1|20220523|50.3| |2|20230503|77.9| ![](https://hackmd.io/_uploads/rJcHdrjH3.png) 這裡可以更改欄位名稱和資料型態之類的設定。 ![](https://hackmd.io/_uploads/B1BwuBsr3.png) ## 建立索引 接著我們還要做一個情感搜尋(cognitive search)的服務。 ![](https://hackmd.io/_uploads/rJdf9rsB3.png) 老樣子,取名、設定地區... 等等的設定必須完成。 從 Import data 那邊匯入資料。 ## 透過 Python 進行搜尋 ```python= 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) ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    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.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully