jokerchu 发表于 2017-12-19 12:30:45

nutch和solr建立搜索引擎基础(单机版)

cd ${APACHE_SOLR_HOME}  cp -r server/solr/configsets/basic_configs server/solr/configsets/nutch
  cp ${NUTCH_RUNTIME_HOME}/conf/schema.xml server/solr/configsets/nutch/conf
  mv server/solr/configsets/nutch/conf/managed-schema server/solr/configsets/nutch/conf/managed-schema.backup
  #启动solr服务
  solr start
  #创建nutch core
  solr create -c nutch -d server/solr/configsets/nutch/conf/ -force #-force:强制以root身份执行,生产环境请勿使用该参数
  创建过程并非一帆风顺,整个过程充满了各种bug,从这个角度考虑,生产环境中有必要更换到solr的稳定版,好在这些坑已经趟过:
  问题1:Caused by: Unknown parameters: {enablePositionInc rements=true}
  具体信息:
  Copying configuration to new core instance directory:
  /opt/solr-6.6.0/server/solr/nutch
  Creating new core 'nutch' using command:
  http://localhost:8983/solr/admin/cores?action=CREATE&name=nutch&instanceDir=nutch
  ERROR: Error CREATEing SolrCore 'nutch': Unable to create core Caused by: Unknown parameters: {enablePositionIncrements=true}
  解决办法:
  vimserver/solr/configsets/nutch/conf/schema.xml 找到并去掉enablePositionIncrements=true
  问题2:ERROR: Error CREATEing SolrCore 'nutch': Unable to create core Caused by: defaultSearchField has been deprecated and is incompatible with configs with luceneMatchVersion >= 6.6.0.Use 'df' on requests instead.
  解决办法:
  vim server/solr/configsets/nutch/conf/solrconfig.xml 将luceneMatchVersion版本修改为6.2.0
  问题3:org.apache.solr.common.SolrException: fieldType 'booleans' not found in the schema
  解决办法:
  vim /opt/solr-6.6.0/server/solr/configsets/nutch/conf/solrconfig.xml
  找到booleans,替换成boolean,如下:
  <lst name="typeMapping">
  <str name="valueClass">java.lang.Boolean</str>
  <str name="fieldType">boolean</str>
  </lst>
  Then it will work..
  问题3以后,会发生多起类似事件,如下:
  ERROR: Error CREATEing SolrCore 'nutch': Unable to create core Caused by: fieldType 'tdates' not found in the schema
  ERROR: Error CREATEing SolrCore 'nutch': Unable to create core Caused by: fieldType 'tlongs' not found in the schema
  ERROR: Error CREATEing SolrCore 'nutch': Unable to create core Caused by: fieldType 'tdoubles' not f ound in the schema
  参照问题3的方法,一次性去掉''中关键字的复数形式即可。
  问题4:ERROR:
  Core 'nutch' already exists!
  Checked core existence using Core API command:
  http://localhost:8983/solr/admin/cores?action=STATUS&core=nutch
  解决办法:
  solr delete -c nutch       #删除core 'nutch'
  如果删除完,还提示这个错误,这是由于每次修改完配置文件,需要重启下solr服务,更新下状态。
  最终的执行结果:
  solr create -c nutch -d server/solr/configsets/nutch/conf/ -force
  Copying configuration to new core instance directory:
  /opt/solr-6.6.0/server/solr/nutch
  Creating new core 'nutch' using command:
  http://localhost:8983/solr/admin/cores?action=CREATE&name=nutch&instanceDir=nutch
  {
  "responseHeader":{
  "status":0,
  "QTime":3408},
  "core":"nutch"}
  执行成功!
  在浏览器中访问
  http://localhost:8983/solr/#/
  可以看到名称为nutch的core
页: [1]
查看完整版本: nutch和solr建立搜索引擎基础(单机版)