Nutch集成Solr中文分词Schema

2019-03-27 00:22|来源: 网路

 <?xml version="1.0" encoding="UTF-8" ?>

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
license agreements. See the NOTICE file distributed with this work for additional 
information regarding copyright ownership. The ASF licenses this file to 
You under the Apache License, Version 2.0 (the "License"); you may not use 
this file except in compliance with the License. You may obtain a copy of 
the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
by applicable law or agreed to in writing, software distributed under the 
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
OF ANY KIND, either express or implied. See the License for the specific 
language governing permissions and limitations under the License. -->
<!-- Description: This document contains Solr 3.1 schema definition to be 
used with Solr integration currently build into Nutch. See https://issues.apache.org/jira/browse/NUTCH-442 
https://issues.apache.org/jira/browse/NUTCH-699 https://issues.apache.org/jira/browse/NUTCH-994 
https://issues.apache.org/jira/browse/NUTCH-997 and http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/ 
example/solr/conf/schema.xml?view=markup for more info. -->
<schema name="nutch" version="1.3">
<types>
<fieldType name="string" class="solr.StrField"
sortMissingLast="true" omitNorms="true" />
<fieldType name="long" class="solr.TrieLongField"
precisionStep="0" omitNorms="true" positionIncrementGap="0" />
<fieldType name="float" class="solr.TrieFloatField"
precisionStep="0" omitNorms="true" positionIncrementGap="0" />
<fieldType name="date" class="solr.TrieDateField"
precisionStep="0" omitNorms="true" positionIncrementGap="0" />
 
<fieldType name="cache_text" class="solr.TextField"
positionIncrementGap="100">
</fieldType>
 
<fieldType name="text" class="solr.TextField"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory"
mode="complex" dicPath="dic" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
<analyzer type="query">
<tokenizer class="com.chenlb.mmseg4j.solr.MMSegTokenizerFactory"
mode="complex" dicPath="dic" />
<filter class="solr.LowerCaseFilterFactory" />
</analyzer>
</fieldType>
<fieldType name="url" class="solr.TextField"
positionIncrementGap="100">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory" />
<filter class="solr.LowerCaseFilterFactory" />
<filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" />
</analyzer>
</fieldType>
</types>
<fields>
<field name="id" type="string" stored="true" indexed="true" />
 
<!-- core fields -->
<field name="segment" type="string" stored="true" indexed="false" />
<field name="digest" type="string" stored="true" indexed="false" />
<field name="boost" type="float" stored="true" indexed="false" />
 
<!-- fields for index-basic plugin -->
<field name="host" type="url" stored="false" indexed="true" />
<field name="site" type="string" stored="false" indexed="true" />
<field name="url" type="url" stored="true" indexed="true"
required="true" />
<field name="content" type="text" stored="false" indexed="true" />
<field name="title" type="text" stored="true" indexed="true" />
<field name="cache" type="string" stored="true" indexed="false" />
<field name="cache_content" type="cache_text" stored="true"
indexed="false" />
<field name="tstamp" type="date" stored="true" indexed="true" />
 
<!-- fields for index-anchor plugin -->
<field name="anchor" type="string" stored="true" indexed="true"
multiValued="true" />
 
<!-- fields for index-more plugin -->
<field name="type" type="string" stored="true" indexed="true"
multiValued="true" />
<field name="contentLength" type="long" stored="true" indexed="false" />
<field name="lastModified" type="date" stored="true" indexed="false" />
<field name="date" type="date" stored="true" indexed="true" />
 
<!-- fields for languageidentifier plugin -->
<field name="lang" type="string" stored="true" indexed="true" />
 
<!-- fields for subcollection plugin -->
<field name="subcollection" type="string" stored="true" indexed="true"
multiValued="true" />
 
<!-- fields for feed plugin (tag is also used by microformats-reltag) -->
<field name="author" type="string" stored="true" indexed="true" />
<field name="tag" type="string" stored="true" indexed="true"
multiValued="true" />
<field name="feed" type="string" stored="true" indexed="true" />
<field name="publishedDate" type="date" stored="true" indexed="true" />
<field name="updatedDate" type="date" stored="true" indexed="true" />
 
<!-- fields for creativecommons plugin -->
<field name="cc" type="string" stored="true" indexed="true"
multiValued="true" />
</fields>
<uniqueKey>id</uniqueKey>
<defaultSearchField>content</defaultSearchField>
<solrQueryParser defaultOperator="OR" />
</schema>
 

本文出自 “果壳中的宇宙” 博客,请务必保留此出处http://williamx.blog.51cto.com/3629295/773815


转自:http://williamx.blog.51cto.com/3629295/773815

相关问答

更多
  • 3.1.Nutch安装 l 解压 tar -zxvf apache-nutch-1.4-bin.tar.gz l 终端下cd到目录 apache-nutch-1.4-bin/runtime/local,下面会有 bin conf lib ...
  • 3.1.Nutch安装 l 解压 tar -zxvf apache-nutch-1.4-bin.tar.gz l 终端下cd到目录 apache-nutch-1.4-bin/runtime/local,下面会有 bin conf lib ...
  • Solr 是一个可供企业使用的、基于 Lucene 的开箱即用的搜索服务器。对Lucene不熟?那么建议先看看下面两篇文档:   实战Lucene,第 1 部分: 初识 Lucene: http://www.ibm.com/developerworks/cn/java/j-lo-lucene1/   用Lucene加速Web搜索应用程序的开发: http://www.ibm.com/developerworks/cn/web/wa-lucene2/   一、 solr介绍   solr是基于Lucene J ...
  • StandardAnalyzer是可以用于中文分词,但它是一元分词,机械地将一个汉字做为一个词元来切分的,速度慢不说,语义也没有了,当然应该能保证查全率,呵呵. ChineseAnalyzer比它好一点,也相当于一元分词。 lucene的第三方分词包有很多,上面两个不建议使用。可以去了解: IK_CAnalyzer 庖丁解牛分词器 JE分词器
  • Nutch是构建网络爬虫和搜索引擎的框架。 Nutch可以完成从收集网页到建立倒排索引的整个过程。 它也可以将这些索引推送到Solr。 Solr主要是一个搜索引擎,支持分面搜索和许多其他简洁的功能。 但Solr不提取数据,你必须提供它。 因此,也许你必须要问的第一件事是在你是否有可用的索引数据(在XML中,在CMS或数据库中)。 在这种情况下,您应该只使用Solr并为其提供数据。 另一方面,如果你不得不从网络上获取数据,你可能更愿意使用Nutch。 Nutch is a framework to build ...
  • 这主要是Nutch使用的Solrj版本罐和您尝试集成的Solr 3.6之间的javabin不兼容性。 您需要更新Solrj罐并重新生成作业。 按照论坛中提到的步骤操作。 This is mainly the javabin incompatiblity between the Solrj version jars used by Nutch and the Solr 3.6 which you are trying to integrate. You would need to update the Sol ...
  • 问题是solr,nutch和hbase之间的版本不兼容。 这篇文章对我来说非常合适。 The problem was version incompatibility between solr, nutch and hbase. This article worked perfectly for me.
  • 您需要将以下Apache Commons库添加到类路径中: commons-httpclient.jar (您可以将它放在nutch安装所使用的其他JAR所在的文件夹中)。 你可以在这里找到当前版本的HttpClient http://hc.apache.org/httpcomponents-client-ga/ 请注意,您的Nutch版本可能使用较旧版本的HttpClient,而当前版本的HttpClient与旧版本不兼容。 在这种情况下,您需要下载旧版本的HttpClient,并在您的库中包含旧版本。 ...
  • 使用cygwin,这是一个很好的指南,可以将它们组合在一起: http://amac4.blogspot.com/2013/07/setting-up-solr-with-apache-tomcat-be.html Use cygwin, heres an excellent guide to set them up together: http://amac4.blogspot.com/2013/07/setting-up-solr-with-apache-tomcat-be.html
  • 在目前阶段,Nutch只负责抓取网页,这意味着访问网页,提取内容,找到更多链接并重复这个过程(我正在跳过很多复杂的东西,但希望你能得到这个想法) 。 爬网过程的最后一步是将数据存储在后端(ES / Solr是1.x分支上支持的数据存储)。 因此,在这个步骤中,Solr开始发挥作用,在Nutch完成其工作之后,您需要将数据存储在某处以便能够在其上执行查询:这是Solr作业。 前段时间Nutch包含了编写倒排索引的能力(正如问题中所解释的那样),但是决定(也是前一段时间)是弃用这个以支持使用Solr / ES( ...