对于TIMEUUID,Datastax dsetool Solr create_core失败

时间:2014-12-27 20:57:25

标签: solr datastax-enterprise datastax

DataStax Enterprise Server 4.6.0上运行Datastax工具   从现有表格中从头开始生成Solr

dsetool create_core ks.table generateResources=true distributed=true reindex=true

GOT

org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: 

    Type org.apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.TimeUUIDType) 

is not supported with automatic Solr schema generation.

根据这个http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/srch/srchSolrType.html,Solr从4.5开始支持uuid和timeuuid

连连呢?

1 个答案:

答案 0 :(得分:1)

由于Solr默认不识别timeuuid,我们需要手动创建schema.xml文件,如下所示

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema name="autoSolrSchema" version="1.5">
<types>
<fieldType class="org.apache.solr.schema.StrField" name="StrField"/>
<fieldType class="org.apache.solr.schema.UUIDField" name="UUIDField"/>
<fieldType class="org.apache.solr.schema.TextField" name="TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
<fieldType class="org.apache.solr.schema.TrieFloatField" name="TrieFloatField"/>
</types>
<fields>
<field indexed="true" multiValued="false" name="article_url" stored="true" type="StrField"/>
<field indexed="true" multiValued="false" name="articleid" stored="true" type="UUIDField"/>
<field indexed="true" multiValued="false" name="article_title" stored="true" type="StrField"/>
<field indexed="true" multiValued="false" name="image" stored="true" type="StrField"/>
<field indexed="true" multiValued="false" name="history" stored="true" type="UUIDField"/>
</fields>
<uniqueKey>(articleid)</uniqueKey>
</schema> 

并将timeuuid字段定义为UUIDField,请参阅history

然后运行

dsetool create_core kular.articles schema=/home/ubuntu/articles_schema.xml generateResources=true distributed=true reindex=true