您的位置:首页 > 其它

solr使用过程中遇到的一些问题

2017-03-08 09:04 344 查看
1.solr部署到tomcat报错 com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。 

有可能是由于上面的web.xml中写了中文的注释

2.对表进行查询时
http://localhost:8080/solr/db/dataimport?command=full-import&clean=true&commit=true&wt=json&indent=true&entity=fkm_resource&verbose=false&optimize=false&debug=false&id=1
报错 "error":{

    "msg":"Data Config problem: 对实体 \"characterEncoding\" 的引用必须以 ';' 分隔符结尾。",

    "trace":"org.apache.solr.handler.dataimport.DataImportHandlerException: Data Config problem: 对实体 \"characterEncoding\" 的引用必须以 ';' 分隔符结尾。

data-config中数据库的配置  url="jdbc:mysql://localhost:3306/fkm?useUnicode=true&characterEncoding=utf8"  

要改为 

  url="jdbc:mysql://localhost:3306/fkm?useUnicode=true&characterEncoding=utf8"  

意思就是:在xml的配置文件中 ;要用  &   代替。 

 3.org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error initializing QueryElevationComponent.

日志的报错 

Exception during parsing file: elevate.xml:org.xml.sax.SAXParseException; systemId: solrres:/elevate.xml; lineNumber: 35; columnNumber: 32; 注释中不允许出现字符串 "--"。

4.使用多个core时要修改core所在的solr.xml中的内容

<solr persistent="true" sharedLib="lib">

 <property name="snapshooter" value="/home/solr-user/solr/bin/snapshooter.sh" />

  <!--

  adminPath: RequestHandler path to manage cores.  

    If 'null' (or absent), cores will not be manageable via request handler

  -->

  <cores adminPath="/admin/cores" host="${host:}" hostPort="${jetty.port:8983}" hostContext="${hostContext:solr}">

    <core name="collection1" instanceDir="collection1">

  <property name="dataDir" value="E:\solr-tomcat\solr\data\collection1" />

 </core>

 <core name="core0" instanceDir="core0">

  <property name="dataDir" value="E:\solr-tomcat\solr\data\core0" />

 </core>

 <core name="core1" instanceDir="core1">

  <property name="dataDir" value="E:\solr-tomcat\solr\data\core1" />

 </core>

  </cores>

  

     

    <shardHandlerFactory name="shardHandlerFactory" class="HttpShardHandlerFactory">

      <str name="urlScheme">${urlScheme:}</str>

    </shardHandlerFactory>

         

</solr>

替换掉原来的内容  原始的solr.xml文件并没有对core的单独配置(因为都是默认的路劲)。而多core的配置文件则需要对core进行基本配置,主要包含“name”(core的名字)、“instanceDir”(在主目录下的相对路径)、“confDir”(配置文件的目录路径,即conf目录,默认是core下的conf目录)、“dataDir”(数据文件的目录路径,即data目录,默认是core下的data目录)等。

    一些关键的配置值是:

      A)、Persistent="false"指明运行时的任何修改我们不做保存。如拷贝。如果你想保存从启动起的一些改动,那就把 persistent设置为true。如果你的index策略是完成建index到一个纯净的core中然后交换到活动core 那么你绝对应该设为true。

      B)、sharedLib="lib"指明了所有core的jar文件的lib目录。如果你有一个core有自己需要的jar文件,那么你可以把他们置入到core/lib目录。例如:karaoke core 使用 Solr Cell来索引化富文本内容,因此那些用来解析和抽取富文本的jar文件被放到./examples/cores/karaoke/lib/.

    2.3、运行

    如果上面的配置都正常的话,基本的配置都ok了!那我们重启tomcat,打开admin界面

<solr>

  <solrcloud>

    <str name="host">${host:}</str>

    <int name="hostPort">${jetty.port:8983}</int>

    <str name="hostContext">${hostContext:solr}</str>

    <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>

    <int name="zkClientTimeout">${zkClientTimeout:30000}</int>

    <int name="distribUpdateSoTimeout">${distribUpdateSoTimeout:600000}</int>

    <int name="distribUpdateConnTimeout">${distribUpdateConnTimeout:60000}</int>

  </solrcloud>

  <shardHandlerFactory name="shardHandlerFactory"

    class="HttpShardHandlerFactory">

    <int name="socketTimeout">${socketTimeout:600000}</int>

    <int name="connTimeout">${connTimeout:60000}</int>

  </shardHandlerFactory>

</solr>

5.org.apache.solr.common.SolrException: Invalid UUID String: '12'

由于core下面的schema.xml中的<uniqueKey>uuid</uniqueKey>  没有替换为uuid导致的报错 

6.报错org.apache.solr.search.SyntaxError: Cannot parse 'title:': Encountered "<EOF>" at line 1, column 6.

Was expecting one of:

    <BAREOPER> ...

    "(" ...

  title作为条件是没有判断是否为空

7.Could not load driver: com.mysql.jdbc.Driver Processing Document

没有导入mysql驱动包导致
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: