solr 初探

注:要使用solr 6.0 必需要由java 1.8 及以上的環境html

1. 安裝solr

從apache 官網下載solr軟件包  並解壓 tar zxf solr-x.y.z.tgzjava

我解壓到了數據庫

/home/kfh/software/solr 目錄下apache

2. 運行 solr

進入bin目錄  命令:json

$ bin/solr start

若是正常開啓 能夠打開瀏覽器 0.0.0.0:8983這個端口看到以下圖 說明solr已經啓動了:瀏覽器

 

 

中止solrbash

$ bin/solr stop -p 8983

查看solr運行狀態app

$ bin/solr status

開啓solr帶示例配置ide

solr提供了示例,爲了你們熟悉命令post

$ bin/solr -e techproducts

若是麼有帶示例,則須要你本身建立core

$ bin/solr create -c <name>

咱們會在core-selector 位置看到咱們建立的core

如今咱們由了core,本人理解core至關於es中的index,至關與數據庫吧

可是尚未document,來建立document

$ bin/post -c gettingstarted example/exampledocs/*.xml
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/gettingstarted/update...
Entering auto mode. File endings considered are
xml,json,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt
,log
POSTing file gb18030-example.xml (application/xml) to [base]
POSTing file hd.xml (application/xml) to [base]
POSTing file ipod_other.xml (application/xml) to [base]
POSTing file ipod_video.xml (application/xml) to [base]
POSTing file manufacturers.xml (application/xml) to [base]
POSTing file mem.xml (application/xml) to [base]
POSTing file money.xml (application/xml) to [base]
POSTing file monitor.xml (application/xml) to [base]
POSTing file monitor2.xml (application/xml) to [base]
POSTing file mp500.xml (application/xml) to [base]
POSTing file sd500.xml (application/xml) to [base]
POSTing file solr.xml (application/xml) to [base]
POSTing file utf8-example.xml (application/xml) to [base]
POSTing file vidcard.xml (application/xml) to [base]
14 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/gettingstarted/update...
Time spent: 0:00:00.153

而後咱們作一下簡單的查詢:

http://localhost:8983/solr/gettingstarted/select?q=video

能夠看到查詢出的結果是這樣的:

是一個xml格式的結果

相關文章
相關標籤/搜索