【问题标题】:Solr 4.7.1 with Tomcat 6 doesn't store romanian characters带有 Tomcat 6 的 Solr 4.7.1 不存储罗马尼亚字符
【发布时间】:2014-10-10 14:52:19
【问题描述】:

当尝试将罗马尼亚特殊字符(变音符号)存储到 solr 架构字段中时,例如:

<field name="description" type="text_general" indexed="true" stored="true" required="false"/>

罗马尼亚字符是:(ă,î,â,ș,ț),它们在 SOLR 中被替换为 ?

提到我已经完成了基本设置所需的一切,我使用 Tomcat6 运行它。

我的 Solr 版本是 4.7.1

【问题讨论】:

    标签: tomcat6 solr4 php-5.4


    【解决方案1】:

    确保以正确的编码向 Solr 提交数据。

    还要考虑为内容类型指定字符集。例如。内容类型:文本/纯文本; charset=UTF-8

    还可以尝试检查 Solr Side 是如何解析数据的。只需调试此方法:

    org.apache.solr.servlet.SolrRequestParsers.parseParamsAndFillStreams(HttpServletRequest, ArrayList<ContentStream>)
    

    见这行:

    final String cs = ContentStreamBase.getCharsetFromContentType(req.getContentType());
    final Charset charset = (cs == null) ? IOUtils.CHARSET_UTF_8 : Charset.forName(cs);
    

    Solr 应该在这里提供 UTF-8。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-08
      • 1970-01-01
      相关资源
      最近更新 更多