【发布时间】: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)
【问题讨论】: