iT邦幫忙

0

Apache Solr 安裝及匯入資料

  • 至官網下載最新版Apache Solr
    https://ithelp.ithome.com.tw/upload/images/20190619/201184354PZbaCij62.png

  • 將Solr放在C:\user\wesley中
    https://ithelp.ithome.com.tw/upload/images/20190619/20118435C6AUEr0ehs.png

  • 啟動Solr

  1. 到windows下方的功能表開啟”搜尋”
  2. 輸入”cmd”,並將其開啟
  3. cd solr-7.5.0\bin \將位置指向solr的bin目錄中
  4. solr start \啟動solr
    https://ithelp.ithome.com.tw/upload/images/20190619/20118435eaNWp2eTWI.png
  • 新增資料夾
    原先已有預設一個資料夾(mycore),若想存放不同用途之data,則需要創建一個新資料夾。
  1. 在cmd中輸入:solr create -c xxx
    (底線部分為新資料夾名稱,我命名為fincore)
  • 匯入資料前,需執行步驟 (加入新code到managed-schema中):

我的managed-schema路徑:C:\Users\wesley\solr-7.5.0\server\solr
\fincore(資料夾名稱)\conf

  1. 以我的資料為例:有id、company、content……多個欄位。
  2. 每一個欄位都需要輸入一行code,ex: < field name = ”company” type = ”text_general” />
  3. 將檔案儲存,並重新啟動Solr。
    https://ithelp.ithome.com.tw/upload/images/20190619/20118435yq5SVttmpZ.png
    ▲managed-schema 程式碼
  • 匯入資料
  1. 至網頁(chrome或IE) 輸入 http://localhost:8983/solr/
    https://ithelp.ithome.com.tw/upload/images/20190619/20118435CBi5QnqDSc.png
    ▲網頁Solr介面

  2. 選擇資料夾
    https://ithelp.ithome.com.tw/upload/images/20190619/201184354HmDyxpUdP.png
    ▲選擇fincore資料夾

    3.點選Documents,並匯入資料
    https://ithelp.ithome.com.tw/upload/images/20190619/201184359nedMpPJgk.png
    ▲匯入資料

  3. 至query即可有無成功上傳確認資料
    https://ithelp.ithome.com.tw/upload/images/20190619/201184350lUpGOJUEf.png


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言