Solr4.10.2集成Nutch1.9與自帶UI界面使用
Solr4.10.2集成Nutch1.9與自帶UI界面使用
一、Solr4.10.2與Nutch1.9集成
環境:Solr4.10.2已經配置在Tomcat上
Solr的Tomcat配置詳見Solr4.10.2的Tomcat配置
將NUTCH_DIR/conf/schema-solr4.xml
拷貝到SOLR_HOME/collection1/conf/
,重命名為schema.xml,並在<fields>...</fields>
最後添加一行
[html] view plain copy print?
- <field name="_version_" type="long" indexed
="true" stored="true" multiValued="false"/>
重啟Tomcat後即可用Nutch的crawl命令帶上solrURL參數進行爬取索引工作了
Nutch1.9的命令使用詳見Nutch1.9安裝配置與基本使用介紹
在爬取索引後進入solr管理界面可以看到solr下已經有索引好的數據了:
二、Solr4.10.2的自帶UI界面(Solritas)
1.拷貝solr-4.10.2\contrib\velocity\lib以及solr-4.10.2\dist下面的所有jar包到SOLR_SERVER\WEB-INF\lib目錄下
2.如果不進行上一步集成Nutch,這一步就可以跳過了,如果集成了Nutch則需要在新的schema.xml文件中繼續添加配置
① 在</types>前加上
[html] view plain copy print?
- <!-- Money/currency field type. Seehttp://wiki.apache.org/solr/MoneyFieldType
- Parameters:
- defaultCurrency: Specifies thedefault currency if none specified. Defaults to "USD"
- precisionStep: Specifies the precisionStep for the TrieLongfield used for the amount
- providerClass: Lets you plug in other exchange providerbackend:
- solr.FileExchangeRateProvider is the default and takes one parameter:
- currencyConfig:name of an xml file holding exchange rates
- solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org:
- ratesFileLocation:URL or path to rates JSON file (default latest.json on the web)
- refreshInterval:Number of minutes between each rates fetch (default: 1440, min: 60)
- -->
- <fieldType name="currency"class="solr.CurrencyField" precisionStep="8"defaultCurrency="USD" currencyConfig="currency.xml" />
- <!-- boolean type: "true" or "false" -->
- <fieldType name="boolean" class="solr.BoolField"sortMissingLast="true"/>
② 在</fields>前加上
[html] view plain copy print?- <field name="cat" type="string"indexed="true" stored="true" multiValued="true"/>
- <field name="manu_exact" type="string"indexed="true" stored="false"/>
- <field name="content_type" type="string"indexed="true" stored="true"multiValued="true"/>
- <field name="price" type="float" indexed="true"stored="true"/>
- <field name="popularity" type="int"indexed="true" stored="true" />
- <field name="inStock" type="boolean"indexed="true" stored="true" />
- <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
- <dynamicField name="*_c" type="currency" indexed="true" stored="true"/>
- <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
③ 在</schema>前加上
[html] view plain copy print?
- <copyField source="author" dest="author_s"/>
- <copyField source="price"dest="price_c"/>
④ 中文分詞按照之前的方法配置就好,IK分詞器配置詳見Solr4.10.2的IK Analyzer分詞器配置
3.重啟Tomcat,訪問http://localhost:8080/solr/browse即可
參考資料:Solr browse solritas的使用
nutch1.8+solr 4 配置過程+ikanalayzer2012 中文分詞器
本文固定連接:http://blog.csdn.net/fyfmfof/article/details/42803841
Solr4.10.2集成Nutch1.9與自帶UI界面使用