lucene 08 solr匯入資料庫資料

2022-08-19 06:48:15 字數 2901 閱讀 7825

一步:在solr家目錄中匯入 下圖的jar包

第二步:配置solr 家目錄 solr_home\collection1\conf\solrconfig.xml。在config標籤下加入requesthandler標籤

第三步:在solr 家目錄 solr_home\collection1\conf\ 下新建 data-config.xml檔案。就是在第二步配置的data-config.xml檔案。內容如下

第四步:在solr 家目錄 solr_home\collection1\conf\schema.xml  下配置第三步中自定義的域

<

fieldtype

name

="text_ik"

class

="solr.textfield"

>

<

analyzer

class

="org.wltea.analyzer.lucene.ikanalyzer"

/>

fieldtype

>

<

field

name

="title_ik"

type

="text_ik"

indexed

="true"

stored

="true"

/>

<

field

name

="content_ik"

type

="text_ik"

indexed

="true"

stored

= "false"

multivalued

="true"

/>

<

field

name

="blog_title"

type

="text_ik"

indexed

="true"

stored

="true"

/>

<

field

name

="blog_summary"

type

="text_ik"

indexed

="true"

stored

="true"

/>

<

field

name

="blog_keyword"

type

="text_ik"

indexed

="true"

stored

="true"

/>

第五步:登入solr ,匯入資料

第六步:查詢資料

solr系列二 solr匯入資料庫資料

2.找到d solr home catalog conf schema.xml來配置solr和資料庫的對應字段。uniquekey是文件的唯一標識,必須標識對應的字段,否則solr建立索引報錯。此處的field的name屬性最好和資料庫的字段保持一致,這樣我們可以減少一些對映配置。具體配置如下 ca...

solr的core匯入資料庫資料

準備材料資料庫指令碼 user itripdb drop table if exists itrip hotel create table itrip hotel id bigint 11 not null auto increment comment 主鍵 hotelname varchar 25...

solr連線資料庫匯入資料

本文簡單講訴 solr建立全文索引,從資料庫匯入資料,生成索引檔案,本文建立在已經搭建好solr應用的情況下,如要了解如何部署solr服務可先看上一文 solr 安裝 環境 jdk 7,solr4.10.1 tomcat 7 1,首先在solrconfig.xml中引入dataimport 路徑 e...