天天看點

在Solr6.3中建立core

一、建立core

建立的solrhome檔案的位置為:D:\solr\solrhome

1. 建立new_core檔案夾

在Solr6.3中建立core

2. 複制D:\solr\solrhome\configsets\basic_configs\conf到new_core檔案夾中

在Solr6.3中建立core

3.在http://localhost:8080/solr/index.html管理界面中添加new_core

在Solr6.3中建立core

點選 add Core 按鈕進行添加

添加成功如下:

在Solr6.3中建立core

4. 可以在Core Selector 中對Core進行操作

在Solr6.3中建立core

Analysis中可以對分詞器分詞效果進行檢視

Query中測試查詢

二、添加資料項

1. 在D:\solr\solrhome\new_core\conf中建立new_core-data-config.xml檔案

在Solr6.3中建立core

2. 在new_core-data-config.xml檔案中進行資料設定

<dataConfig>
	<document>
        <entity name="solrMessage" pk="id">
            <field name="id" />  
            <field name="title"/>  
			<field name="description"/>  
			<field name="keywords"/>  
			<field name="url"/> 
			<field name="pagepath"/>  			
        </entity>
    </document>
</dataConfig>
           

其中id設定為主鍵

3. 在managed-schema插入如下代碼:

<field name="title" type="string" indexed="true" stored="true" required="true" multiValued="true" />
    <field name="description" type="string" indexed="true" stored="true" required="true" multiValued="true" />
    <field name="keywords" type="string" indexed="true" stored="true" required="true" multiValued="true" />
    <field name="url" type="string" indexed="true" stored="true" required="true" multiValued="true" />
    <field name="pagepath" type="string" indexed="true" stored="true" required="true" multiValued="true" />
           

對core的操作完成。然後在solrJ中對資料項進行操作

學習筆記所用,如有錯誤歡迎指出。

參考:http://www.cnblogs.com/fengzhanfei/p/6178261.html

繼續閱讀