【问题标题】:Using Datastax DSE 4.0.3 I get an error when mapping a timeuuid in solr使用 Datastax DSE 4.0.3 在 solr 中映射 timeuuid 时出现错误
【发布时间】:2014-07-26 18:32:55
【问题描述】:

我有一个列族,其中包含一个 timeuuid 作为列的 id(它是一个时间序列)和构成分区键的其他几个列。它还包含未排序的列,其中包含应该可搜索的数据(通过 solr)。

CREATE TABLE events (
    unique_serial bigint,
    time_period int,
    event_id timeuuid,
    search_field_1 int,
    search_field_2 double,
    search_field_3 double,
    summary text,
    data text,
    PRIMARY KEY((unique_serial, time_period), event_id)
) WITH CLUSTERING ORDER BY (event_id DESC);

我的 solr 架构如下所示:

<schema name="events" version="1.1">
    <types>
        <fieldType name="string" class="solr.StrField"/>
        <fieldType name="long" class="solr.LongField" />
        <fieldType name="double" class="solr.DoubleField" /> 
        <fieldType name="int" class="solr.IntField" />
        <fieldType name="text" class="solr.TextField">
            <analyzer>
                 <tokenizer class="solr.StandardTokenizerFactory"/>
            </analyzer>
        </fieldType>
        <fieldType name="uuid" class="solr.UUIDField" />
    </types>
    <fields>
    <field name="unique_serial" type="long" indexed="true"  stored="true"/>
        <field name="time_period" type="int" indexed="false" stored="true" />
        <field name="event_id" type="uuid" indexed="true" stored="true" />
    <field name="search_field_1" type="int" indexed="true"  stored="true"/>
    <field name="search_field_2" type="double" indexed="true"  stored="true"/>
    <field name="search_field_3" type="double" indexed="true"  stored="true"/>
        <field name="summary" type="text" indexed="true" stored="true" />
    </fields>

    <defaultSearchField>summary</defaultSearchField>
    <uniqueKey>(unique_serial,time_period,event_id)</uniqueKey>
</schema>

当我尝试创建 solr 核心时,我收到此错误:

Caused by: java.lang.IllegalStateException: Mismatch between Solr key field event_id with type uuid{class=org.apache.solr.schema.UUIDField,analyzer=org.apache.solr.schema.FieldType$DefaultAnalyzer,args={class=solr.UUIDField}} and Cassandra key alias event_id with type timeuuid
at com.datastax.bdp.search.solr.core.Cql3CassandraSolrSchemaUpdater.validateUniqueKeyStructure(Cql3CassandraSolrSchemaUpdater.java:235)
at com.datastax.bdp.search.solr.core.Cql3CassandraSolrSchemaUpdater.update(Cql3CassandraSolrSchemaUpdater.java:47)
at com.datastax.bdp.search.solr.core.CassandraCoreContainer.create(CassandraCoreContainer.java:244)
... 29 more

如果我将 event_id 更改为 UUID,那么它可以工作,但我想保持按 event_id 排序的行。根据文档,如果 UUID 都是版本 1,则 UUID 将执行此操作,但我喜欢 timeuuid 明确说明时间的重要性并强制执行版本 1。

也许我误解了 datastax 文档,但我认为 timeuuid 是受支持的 (http://www.datastax.com/documentation/datastax_enterprise/4.0/datastax_enterprise/srch/srchSolrType.html)

【问题讨论】:

    标签: solr cassandra datastax


    【解决方案1】:

    看起来像是由“CLUSTERING ORDER BY”指令引起的错误,请尝试不使用它并告诉我们。

    【讨论】:

    • 所以这肯定是集群顺序指令和 TimeUUID 的错误,我们将在即将发布的 4.0.x 版本中包含修复。
    • Solr 现在是否对 UUIDFiled (TimeUUID) 进行排序?看起来它忽略了值的时间性质。
    猜你喜欢
    • 1970-01-01
    • 2014-03-20
    • 2015-02-24
    • 2012-08-19
    • 2016-12-29
    • 2015-03-10
    • 2017-03-20
    • 2020-12-20
    • 1970-01-01
    相关资源
    最近更新 更多