【问题标题】:Datastax dsetool Solr create_core fail for TIMEUUIDDatastax dsetool Solr create_core TIMEUUID 失败
【发布时间】:2015-02-24 14:35:48
【问题描述】:

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

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

得到

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

建议?

【问题讨论】:

    标签: solr datastax-enterprise datastax


    【解决方案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

    【讨论】:

    • 仅供参考,这仅在您有一个按 DESC 聚类顺序的 timeuuid 聚类列时才会出现问题。应该在未来的版本中解决。
    猜你喜欢
    • 2014-07-26
    • 2020-03-20
    • 2015-06-27
    • 2014-03-27
    • 2016-06-01
    • 2014-03-20
    • 2017-10-07
    • 2018-09-25
    • 2013-12-20
    相关资源
    最近更新 更多