標籤:create targe class ada 配置 電腦 div 做了 exists
安裝Solr
首先保證已經正確安裝了Java
下載Solr,當前最新版6.1.0
Solr各個版本
Solr從6.0之後需要Java1.8所以如果使用Solr6.0及其以上版本,請確保Java版本在1.8之上
將Solr下載之後解壓在電腦的某個目錄,我解壓到了D盤根目錄下
啟動Solr
啟動Solr(windws版,以下都是windows下的)
進入solr的解壓目錄
cd binsolr.cmd start
Solr啟動成功!
管理主控台地址為
http://localhost:8983/solr/
第一次使用的時候提醒No cores available
什麼是core
先來看一段官方說明。
In Solr, the term is used to refer to a single index and associated transaction log and configuration files core
(including the and Schema files, among others). Your Solr installation can have multiple solrconfig.xml
cores if needed, which allows you to index data with different structures in the same server, and maintain more
control over how your data is presented to different audiences. In SolrCloud mode you will be more familiar with
Behind the scenes a collection consists of one or more cores. the term collection.
Cores can be created using script or as part of SolrCloud collection creation using the APIs. C bin/solr ore-spe
cific properties (such as the directories to use for the indexes or configuration files, the core name, and other
options) are defined in a core.properties file. Any core.properties file in any directory of your Solr
installation (or in a directory under where solr_home is defined) will be found by Solr and the defined properties
will be used for the core named in the file.
主要的意思是which allows you to index data with different structures in the same server
允許使用者以不同的資料結構來對資料進行索引。
可以使用
bin/solr create -c <name>
來建立core
運行樣本資料
這裡我們使用官方給的樣本。
先停掉solr
停掉solr必須指定連接埠號碼,也可以使用 -all來停掉所有的solr服務
solr.cmd stop -all
使用樣本core啟動solr(沒有特殊說明所處的目錄為solr解壓路徑\bin下)
solr.cmd -e techproducts
我們來看一下上面的命令solr都做了什麼操作
- 建立目錄 在example下建立了techproducts\solr目錄
- 啟動solr 使用-s指定了solr.home
- 建立core
- 索引
- 上傳檔案
等操作
其中啟動命令使用了-s 我們來看一下-s的含義
Sets the solr.solr.home system
property; Solr will create core
directories under this directory. This
allows you to run multiple Solr instances
on the same host while reusing the
same server directory set using the -d
parameter. If set, the specified directory
should contain a solr.xml file, unless
solr.xml exists in ZooKeeper. The
default value is . server/solr
This parameter is ignored when running
examples (-e), as the solr.solr.home
depends on which example is run.
我們看一下原始的solr下example目錄
執行之後example目錄
techproducts下面有logs和solr目錄
執行post命令提交了一下檔案
再回控制台
在此進入
http://localhost:8983/solr/#/
我們在core admin中就可以看到建立的techproducts了
Solr is built to find documents that match queries. Solr’s schema provides an idea of how content is structured
(more on the schema ), but without documents there is nothing to find. Solr needs input before it can do later
much.
solr是用來尋找關鍵字匹配的文檔的。solr的schema決定了內容的結構,沒有文檔,就無從查詢。
剛才我們使用的-e啟動命令已經將範例文件提交了。
接下來我們來查詢(依然以官方的樣本,查詢video)
http://localhost:8983/solr/techproducts/select?q=video
結果如下
還有很多詳細的查詢可以參考官方文檔
快速預覽
簡單描述了Solr如何整合到應用中
In the scenario above, Solr runs along side other server applications. For example, an online store application
would provide a user interface, a shopping cart, and a way to make purchases for end users; while an inventory
management application would allow store employees to edit product information. The product metadata would
be kept in some kind of database, as well as in Solr.
Solr使用步驟如下
- 定義schema,schema告訴Solr文檔如何被索引,在線上商店樣本中,schema可以用來定義商品名稱,描述,價格,製造商等欄位。
- 部署Solr
- 將solr文檔提供給用來來檢索
- 在應用中暴露搜尋介面
更進一步
You already have some idea of Solr’s schema. This section describes Solr’s home directory and other
configuration options.
When Solr runs in an application server, it needs access to a home directory. The home directory contains
important configuration information and is the place where Solr will store its index. The layout of the home
directory will look a little different when you are running Solr in standalone mode vs when you are running in
SolrCloud mode.
The crucial parts of the Solr home directory are shown in these examples:
Solr的主目錄
當Solr在應用伺服器上啟動並執行時候,它需要訪問主目錄,主目錄包含重要的配置資訊,也是Solr儲存索引的地方。主目錄的結構如下
最主要的檔案如下
solr.xml
為Solr執行個體指定配置
core.properties
定義每一個core的配置,比如名字,所在的core,schema的位置和其他參數
轉http://blog.csdn.net/frankcheng5143/article/details/52291176
Solr入門-Solr服務安裝(windows系統)