【问题标题】:Uploading Data to Solr with Data import handler使用数据导入处理程序将数据上传到 Solr
【发布时间】:2019-03-05 17:07:21
【问题描述】:

您好,我正在努力使用数据导入处理程序将我的数据上传到 solr。我正在做的是使用服务器文件夹中的命令启动 solr 服务器

solr start

然后,这允许我在我的计算机上打开一个本地主机,其中显示了我之前设置的核心。

然后我编辑了文件 solrconfig.xml 和 schema.xml

在 solrconfig.xml 中,我将以下代码行放入

<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*.jar" /> 

<schemaFactory class="ClassicIndexSchemaFactory"/>

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler" startup="lazy">
<lst name="defaults">
    <str name="config">data-config.xml</str>
</lst>

在 schema.xml(从托管模式文件重命名)我添加了

<field name="_version_" type="plong" indexed="true" stored="true"/>
<field name="id" type="string" indexed="true" stored="true" required="true"/>
<field name="title" type="string" indexed="true" stored="true"/>
<field name="revision" type="pint" indexed="true" stored="false"/>
<field name="user" type="string" indexed="true" stored="false"/>
<field name="userId" type="pint" indexed="true" stored="false"/>
<field name="text" type="text_en" indexed="true" stored="false"/>
<uniqueKey>id</uniqueKey>

然后我使用以下代码创建了一个 data-config.xml 文件

<dataConfig>
<dataSource type="FileDataSource" encoding="UTF-8"/>
<document>
    <entity name="page"
            processor="XPathEntityProcessor"
            stream="true"
            forEach="/mediawiki/page"
            url="/Volumes/BACKUP/enwiki-latest-pages-articles.xml"
            transformer="RegexTransformer,DateFormatTransformer"
            >
        <field column="id" xpath="/mediawiki/page/id" />
        <field column="title" xpath="/mediawiki/page/title" />
        <field column="revision" xpath="/mediawiki/page/revision/id" />
        <field column="user" xpath="/mediawiki/page/revision/contributor/username" />
        <field column="userId" xpath="/mediawiki/page/revision/contributor/id" />
        <field column="text" xpath="/mediawiki/page/revision/text" />
        <field column="timestamp" xpath="/mediawiki/page/revision/timestamp" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" />
        <field column="$skipDoc" regex="^#REDIRECT .*" replaceWith="true" souceColName="text"/>
    </entity>
</document>

在这里,我希望索引的 xml 存储在我计算机的外部硬盘驱动器上。在我在浏览器中输入以下内容之前,一切似乎都运行良好

http://localhost:8983/solr/wiki/dataimport?command=full-import

如下所示

有谁知道如何解决这个问题?我正在使用 solr 7.7,Stackoverflow 上的所有问题似乎都是针对早期版本的。我要遵循的教程是https://www.youtube.com/watch?v=2VkFQTqrRYo&t=310s,它很旧,所以我认为这就是我收到此错误的原因。

【问题讨论】:

  • 我认为会有一个更完整的日志来显示它无法添加文档的实际原因 - 由于错误来自作者,最初的猜测是它可以'出于某种原因不将索引文件或事务日志写入磁盘。
  • @matLindh 你知道我会去哪里解决这个问题吗?

标签: xml solr wikipedia dataimporthandler


【解决方案1】:

原来我需要做的就是在 solrconfig.xml 中进行更改:

&lt;updateRequestProcessorChain name="add-unknown-fields-to-the-schema" default="${update.autoCreateFields:false}"

(假而不是真)

【讨论】:

    【解决方案2】:

    错误说明了一切...clasNotFoundException...检查您的类路径,看起来 DataImportHandler 不在您的类路径中...

    <lib dir="../../../dist/" regex="apache-solr-dataimporthandler-.*\.jar" />
    

    配置更改后重启码头服务器。

    【讨论】:

    • 那仍然没有解决问题!!最终从我的计算机上完全删除了 Solr 并重新安装了 7.6.0 并且一切正常,除了现在我的文档无法上传,即使它们正在被索引
    • 我对帖子进行了编辑以显示新错误。我现在也在使用 Solr 7.6
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多