【问题标题】:Solr error, unknown fieldSolr 错误,未知字段
【发布时间】:2011-03-10 18:13:27
【问题描述】:

我刚开始使用Solr php client。首先,我为要添加到索引中的数据定义了一个模式

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="qullet" version="1.2">
    <fields>
        <field name="id" type="string" indexed="true" 
                   stored="true" required="true"/>
        <field name="title" type="string" indexed="true"
                   stored="true" required="true"/>
        <field name="description" type="text" indexed="true"
                   stored="true" required="true"/>
        <field name="test" type="text" indexed="true"
                   stored="true" required="true"/>
    </fields>
    <uniqueKey>id</uniqueKey>
</schema>

向索引添加数据会出现以下错误

"400" Status: ERRORunknown_field_test

如果我删除现场测试一切正常。

【问题讨论】:

  • 您是否重新启动了 Solr / 重新加载了 Solr 核心?
  • 感谢我重新启动了 solr,我得到“在字段 id 上指定的未知字段类型'字符串'”

标签: php xml solr


【解决方案1】:

您缺少&lt;fieldType&gt;s。参考sample schema.xml

【讨论】:

  • 我必须用我的字段扩展这个示例 schema.xml 吗?我使用了本教程,没有定义类型drupal.ayalon.ch/en/code-samples/solr-php-client-example
  • @ArtWorkAD 注意&lt;schema&gt;&lt;fields&gt; 之间的'...',这就是fieldTypes 的来源。
  • @ArtWorkAD 作者可能假设编辑了 Solr 附带的示例 schema.xml。
  • 我是否必须删除所有现有的 元素并用我自己的替换它们?当我这样做时,它又给了我一个错误
  • 谢谢,我只是删除了大部分 元素并添加了我自己的元素,现在它可以工作了
猜你喜欢
  • 2019-05-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-24
  • 1970-01-01
相关资源
最近更新 更多