【问题标题】:Indexing plain text files in Solr在 Solr 中索引纯文本文件
【发布时间】:2019-01-01 00:37:51
【问题描述】:

很难找到结构良好的手册和信息,如何在 Solr (.txt) 中为纯文本进行索引。

我明白了如何使用 Solr 标准数据类型,如 .xml 或 .json,但直到现在还没有至少一本结构化且完整描述的纯文本索引手册(尤其是如果您的文件不包含 id 和只有单词和空格)。

期待收到一些可以帮助我解决这个问题的资源或一些可以帮助我解决这个问题的代码示例。

【问题讨论】:

    标签: indexing solr plaintext


    【解决方案1】:

    您应该仍然可以使用extract 端点(在后台使用 Apache Tika)。可以提供字段值through the query string as seen in the example for the techproducts data set

    /solr/techproducts/update/extract?literal.id=doc1&commit=true
    

    literal.id=doc1 参数为无法从提交的数据集中提取的字段提供实际值。

    确保set the Content-Type header to text/plain when you're submitting(除非您作为常规 html 表单上传提交)。

    【讨论】: