如何使用Solr对通过nutch爬行获得的文档进行语言识别?
我安装了Nutch 1.9和Solr 4.8.1 . 我在Solr Admin页面中通过Core Admin添加了一个名为 "core-test"
的新核心,我在文档索引期间按照Solr wiki中的步骤进行语言检测 .
我通过添加字段修改了core-test / conf中的schema.xml
<field name="language_s" type="string" stored="true" indexed="true"/>
然后,我使用Nutch来抓取一组网页
crawl seed.txt Test http://localhost:8983/solr/core-test 2
Nutch工作正常,但文档的语言未被识别,即当我在http://localhost:8983/solr/#/core-test/query中进行查询并且 q
设置为 ":"
时,我没有获得字段 language_s
.
1 回答
您需要启用Nutch的语言检测 . 将下面的xml标记复制到
Nutch_HOME/conf/nutch-site.xml
:<property> <name>plugin.includes</name> <value>protocol-http|urlfilter-regex|parse-(html|tika)|index-(basic|anchor)|indexer-solr|scoring-opic|urlnormalizer-(pass|regex|basic)|language-identifier</value> </property>
上面的标签启用了与Nutch捆绑在一起的语言检测插件 . 如Nutch's wiki中所述,插件将添加名为"lang"的字段,其中包含文档的语言代码 .