Solr-_version_字段必须存在于架构中并且可以搜索 [英] Solr - _version_ field must exist in schema and be searchable

查看:235
本文介绍了Solr-_version_字段必须存在于架构中并且可以搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Solr很陌生,并且在设置我的第一个示例核心时遇到错误.我正在尝试在管理控制台下添加新的核心,但我收到有关 version 字段的错误.

I am pretty new to Solr and getting error on setting up my first example core. I am trying to add new core under admin dashboard but I am receving error about version field.

有什么解决方法吗?

背景:

  • 操作系统:Windows
  • Solr文件夹:C:\ solr-6.0.0
  • Core Admin Url : http://localhost:8984/solr/#/〜cores
  • 为new_core创建的文件夹:C:\ solr-6.0.0 \ server \ solr \ new_core
  • 错误:创建SolrCore'new_core'时出错:无法创建核心[new_core]原因:_version_字段必须存在于架构中并且可搜索(索引或docValues)和可检索(存储或docValues)而不是multiValued(_version_不存在)
  • OS: Windows
  • Solr Folder: C:\solr-6.0.0
  • Core Admin Url: http://localhost:8984/solr/#/~cores
  • Folder Created For new_core: C:\solr-6.0.0\server\solr\new_core
  • Error: Error CREATEing SolrCore 'new_core': Unable to create core [new_core] Caused by: _version_ field must exist in schema and be searchable (indexed or docValues) and retrievable(stored or docValues) and not multiValued (_version_ does not exist)

Schema Xml:

Schema Xml:

<?xml version="1.0" encoding="UTF-8" ?>

<!--
For fts-solr:

This is the Solr schema file, place it into solr/conf/schema.xml. You may
want to modify the tokenizers and filters.
-->
<schema name="dovecot" version="1.1">
  <types>
    <!-- IMAP has 32bit unsigned ints but java ints are signed, so use longs -->
    <fieldType name="string" class="solr.StrField" omitNorms="true"/>            
    <fieldType name="boolean" class="solr.BoolField" omitNorms="true"/>
    <fieldType name="long" class="solr.LongField" omitNorms="true"/>

    <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>      
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>        
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>                
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>        
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>
 </types>


 <fields>
   <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
   <field name="id" type="string" indexed="true" stored="true" required="true" />       
   <field name="box" type="string" indexed="true" stored="true" required="true" /> 
   <field name="user" type="string" indexed="true" stored="true" required="true" /> 
   <field name="ns" type="string" indexed="true" stored="true" required="false" /> 
   <field name="last_uid" type="boolean" indexed="true" stored="false" /> 
   <field name="hdr" type="text" indexed="true" stored="false" /> 
   <field name="body" type="text" indexed="true" stored="false" /> 
 </fields>

 <uniqueKey>id</uniqueKey>
 <defaultSearchField>body</defaultSearchField>
 <solrQueryParser defaultOperator="AND" />
</schema>

屏幕截图:

推荐答案

您的模式来自一个非常的旧版本Solr的示例.您需要使用Dovecot版本推荐的Solr版本,或者将其调整为新要求.

Your schema comes from an example for a very old version of Solr. You need to either use the version of Solr that is recommended with that version of Dovecot or adjust it to the new requirements.

将您的架构比较为

Compare your schema to the basic example schema that comes with Solr 6 itself. There is quite a number of differences:

  1. 架构版本现在最高为1.6(您是1.1)
  2. 不再需要
  3. types fields 外部标签,您只需按照想要的顺序列出类型/字段
  4. defaultSearchField和solrQueryParser都被视为不再推荐,应将其移至请求中solrconfig.xml中的处理程序配置
  1. Schema version is now up to 1.6 (yours is 1.1)
  2. types and fields outer tags are no longer needed and you just list types/fields in any order you want
  3. defaultSearchField and solrQueryParser are both considered not recommended anymore and should be moved into the request handler configuration in the solrconfig.xml

您的字段名称也应为_version_(带下划线).关于删除这些内容的建议是由于StackOverflow格式(将下划线转换为斜体)引起的.

Your field name should also be _version_ (with underscores). The advice you got about removing those is due to StackOverflow formatting (converting underscores to italic)...

重启后是否出现错误?还是什么都没有.使用新的Solr,内核需要位于solr的主目录下(您似乎位于内核中),并且需要包含 core.properties 文件.如果在创建过程中出错,则可能尚未创建该文件,并且重新启动服务器可能始终不会注意到该集合/核心.只需确保每次测试更改时都重复相同的步骤(例如创建/注册核心)即可.

Are you getting an error after the restart? Or nothing at all. With new Solr, the cores need to be under the solr home (yours seems to be) and needs to contain core.properties file. If you got an error during the creation, that file may not have been created and restarting the server may not notice the collection/core anyway. Just make sure you are repeating the same steps (e.g. creating/registering core) every time as you are testing your changes.

这篇关于Solr-_version_字段必须存在于架构中并且可以搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆