0

我正在使用带有 Windows 命令提示符的 curl 命令使用 Solr Cell 索引一个大型 HTML 页面,如下所示:

curl http://localhost:8987/solr/myexample/update/extract -d @test.html -H 'Content-type:html'

当我在 SOLR 的管理菜单中查询( query?q=*:*&q.op=OR&indent=true )时,我发现我的字段中缺少数据(文本) 。示例:我有一堆 lorem ipsum <p> 标签,但在我的 HTML 页面末尾附近我有另一个段落标签Hello world,这不会出现在 SOLR 管理中。

我在 wiki上找到了以下内容。

大型单个字段。

可以在一条记录中存储数兆字节的文本。这些字段使用起来很笨拙。默认情况下,存储的字符数被剪裁。

它没有详细说明如何防止文本被剪切,也就是说,如果这甚至是导致问题的原因,因为在剪切之前我什至无法在字段中获取 MB 值的数据。

架构.xml

    <field name="main" type="text_general" indexed="true" stored="true"/>
    <field name="div" type="text_general" indexed="true" stored="true"/>
    <field name="doc_id" type="string" uninvertible="true" indexed="true" stored="true"/>
    <field name="date_pub" type="pdate" uninvertible="true" indexed="true" stored="true"/>
    <field name="p" type="text_general" uninvertible="true" indexed="true" stored="true"/>
    <field name="_text_" type="text_general" indexed="true" stored="true" multiValued="true"/>
    <copyField source="*" dest="_text_"/>

solrconfig.xml

  <requestHandler name="/update/extract"
    class="org.apache.solr.handler.extraction.ExtractingRequestHandler">
    <lst name="defaults">
      <str name="lowernames">true</str>
      <str name="uprefix">ignored_</str>
      <str name="fmap.content">content</str>
      <str name="capture">div</str>
      <str name="fmap.div">div</str>
      <str name="capture">h1</str>
      <str name="fmap.h1">h1</str>
      <str name="capture">h2</str>
      <str name="fmap.h2">h2_t</str>
      <str name="capture">p</str>
      <str name="fmap.p">p</str>
    </lst>
  </requestHandler>

Solr 版本: 8.10.1

4

1 回答 1

1

SOLR 单元似乎没有限制字符,但是,不要问我为什么,罪魁祸首是我在下面使用的 curl 命令:

curl http://localhost:8987/solr/myexample/update/extract -d @test.html -H 'Content-type:html'

解决方案:以下命​​令提取所有文本而不截断任何文本(将路径替换为您的 post.jar 和 HTML 文件所在的位置):

java -jar -Dc=myexample -Dauto example\exampledocs\post.jar example\exampledocs\sample.html

值得注意的是,这些是命令提示符的窗口命令。

于 2022-02-01T23:10:46.183 回答