solr匯入csv檔案

來源:互聯網
上載者:User
1  概述

大多數的應用程式將資料存放區在關聯式資料庫、xml檔案中。對這樣的資料進行搜尋是很常見的應用。所謂的DataImportHandler提供一種可配置 的方式向solr匯入資料,可以一次全部匯入,也可以增量匯入。  

 

能夠讀取關聯式資料庫中的資料。 

通過可配置的方式,能夠將資料庫中多列、多表的資料產生solr文檔   

能夠通過solr文檔更新solr 

提供 通過設定檔就能夠匯入所有資料的能力 

能夠配置 “完全匯入”和“增量匯入”的時間 

讓讀取xml檔案,並建立索引成為可配置。 

能夠將 其他的資料來源(例如:ftp,scp,etc)或者其他格式的文檔(Json,csv)以外掛程式的形式整合到項目中。

 

  2.2     匯入csv檔案 2.2.1   配置匯入欄位

修改managed-schema檔案,新增:

<field name="id" type="string" stored="true" indexed="true"/>  <field name="title" type="string" stored="true" indexed="true"/>  <field name="content" type="string" stored="true" indexed="true"/>  

  2.2.2   編輯匯入檔案

 


2.2.3   匯入

匯入方式有多種,以下列出兩種方式匯入,

1、 命令方式匯入:

dos進入solr\bin目錄執行

java -Dtype=text/csv-Durl=http://localhost:8983/solr/solr_test/update -jar post.jar   xxx.csv


2、瀏覽器http方式匯入:

在瀏覽器訪問核心core,其中solr_file為core名稱:

http://localhost:8983/solr/solr_file/update/csv?commit=true&stream.file=E:/application.csv&stream.contentType=text/plain;charset=GB2312

 


執行完成後可以查詢已匯入的資料;



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.