liguotao429 2014-05-21 15:37
浏览 332
已采纳

Solr配置Blob字段报错

SOLR通过dataimport导入oracle数据库数据建立索引,表中含有blob类型的字段,在solrconfig.xml中配置了dataimport请求,data-config.xml文件配置见“data-config.zip”附件,启动solr运行,报“java.lang.RuntimeException: unsupported type : class java.lang.String”的异常,具体见“error.zip”附件。

  • 写回答

1条回答 默认 最新

  • leehuat 2014-05-21 15:56
    关注

    [code="java"]
    其实你这个问题
    在solr官方就说明了, 对于blog字段要转化的
    详见:
    Blob values in my table are added to the Solr document as object strings like B@1f23c5

    The problem occurs because blobs are read as a byte array which does not have a useful toString method. The workaround is to:

    Use convertType="true" on the JdbcDataSource
    Write a Transformer which converts the byte[] into a string type
    You can also use a "cast" sql function which can convert the data type from blob to strings if your database provides such a function
    Note that "convertType" attribute uses the target schema field's type name to convert the value returned by the result set. Therefore, any transformers being used on the entity should be aware of the type information.

    http://wiki.apache.org/solr/DataImportHandlerFaq#Blob_values_in_my_table_are_added_to_the_Solr_document_as_object_strings_like_B.401f23c5
    [/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制