【问题标题】:solr - Getting xyz present in DataConfig does not have a counterpartsolr - 在 DataConfig 中获取 xyz 没有对应项
【发布时间】:2015-07-22 10:34:27
【问题描述】:

我正在使用 Solr 5.2。 我做了以下事情:

  1. solr create -c demo
  2. 复制 schema.xml 并将其放置在 demo/conf 文件夹中。 我添加了一个名为load_date 的字段,如下所示:
<field name="load_date" type="string" indexed="true" stored="true" omitNorms="true"/>
  1. 数据配置如下所示
<document name="xyz">
  <entity name="input" query="select * from test" logLevel="debug" datasource="mbdev">
    <field column="LOAD_DATE" name="load_date" />
  </entity>
</document>

只有 id 字段被填充,并抱怨 DataConfig 中的字段 load_date 在 Solr Schema 中没有对应项。我对照 example-DIH 检查了我的更改,但看不出有任何区别。

我还注意到 Schema Browser 仅列出以下字段:

  • text
  • version
  • id
  • title

我不知道它指的是哪个 schema.xml。我怎样才能找到这个?

【问题讨论】:

    标签: solr


    【解决方案1】:

    发现 solrconfig 正在使用“managed-schema.xml”。

    这里是 the wiki documentation,它解释了托管模式。在使用字段名称更新托管模式后,我让它工作了。

    如果您想使用 Schema.xml ('ClassicIndexSchemaFactory') 而不是 managed-schema.xml,则需要将以下字段类型添加到模式中。 xml

    <fieldType name="booleans" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
    <fieldType name="tdates" class="solr.TrieDateField" precisionStep="6" positionIncrementGap="0" multiValued="true"/>
    <fieldType name="tlongs" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
    <fieldType name="tdoubles" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0" multiValued="true"/>
    

    【讨论】:

      【解决方案2】:

      您只需要遵循类型格式,即为字符串等添加_s

      见下面的名称和描述字段,使用您不需要触摸架构文件,它将使用此约定映射字段类型。

        <document name="Reports">
      <entity name="Report" dataSource="ds1" pk="id"
        query = "select * from dbo.Roles">
          <field column="RoleID" name="id"/>
      <field column="RoleName" name="name_s"/>
      <field column="Description" name="description_t"/>
      </entity>      
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-26
        • 1970-01-01
        • 2011-04-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多