1. 程式人生 > >Solr4.10.2集成Nutch1.9與自帶UI界面使用

Solr4.10.2集成Nutch1.9與自帶UI界面使用

white onf minutes star views ont 參數 too rtm

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?
  1. <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?
  1. <!-- Money/currency field type. Seehttp://wiki.apache.org/solr/MoneyFieldType
  2. Parameters:
  3. defaultCurrency: Specifies thedefault currency if none specified. Defaults to "USD"
  4. precisionStep: Specifies the precisionStep for the TrieLongfield used for the amount
  5. providerClass: Lets you plug in other exchange providerbackend:
  6. solr.FileExchangeRateProvider is the default and takes one parameter:
  7. currencyConfig:name of an xml file holding exchange rates
  8. solr.OpenExchangeRatesOrgProvider uses rates from openexchangerates.org:
  9. ratesFileLocation:URL or path to rates JSON file (default latest.json on the web)
  10. refreshInterval:Number of minutes between each rates fetch (default: 1440, min: 60)
  11. -->
  12. <fieldType name="currency"class="solr.CurrencyField" precisionStep="8"defaultCurrency="USD" currencyConfig="currency.xml" />
  13. <!-- boolean type: "true" or "false" -->
  14. <fieldType name="boolean" class="solr.BoolField"sortMissingLast="true"/>

② 在</fields>前加上

[html] view plain copy print?
  1. <field name="cat" type="string"indexed="true" stored="true" multiValued="true"/>
  2. <field name="manu_exact" type="string"indexed="true" stored="false"/>
  3. <field name="content_type" type="string"indexed="true" stored="true"multiValued="true"/>
  4. <field name="price" type="float" indexed="true"stored="true"/>
  5. <field name="popularity" type="int"indexed="true" stored="true" />
  6. <field name="inStock" type="boolean"indexed="true" stored="true" />
  7. <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
  8. <dynamicField name="*_c" type="currency" indexed="true" stored="true"/>
  9. <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>

③ 在</schema>前加上

[html] view plain copy print?
  1. <copyField source="author" dest="author_s"/>
  2. <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界面使用