【问题标题】:index column type="timestamp" in solr from cassandra database来自cassandra数据库的solr中的索引列type =“timestamp”
【发布时间】:2013-04-25 12:11:21
【问题描述】:

这里我使用的是 DSE-3.0。我想在 cassandra 数据库的 solr 中索引列 type="timestamp" name="DateTime"。对于 type="timestamp",solr 中 schema.xml 中的 fieldType 应该是什么。请帮助我。我非常需要它。 谢谢 这是我的数据库输出:- cqlsh:mykeyspace> SELECT * FROM mysolr ;

键,124 | Date_Time,2013-02-11 10:10:10+0530 |身体,每锅一只鸡... |日期,1933 年 12 月 15 日 |姓名,罗斯福 |标题,炉边聊天

但在查询时没有给出 Date_Time 字段的值。 我在 solr 中的查询输出是:- ID,正文,标题,名称,日期 124,每锅一只鸡......,炉边聊天,罗斯福,“1933 年 12 月 15 日”

我缺少什么配置。请指导我正确的方式。谢谢。

【问题讨论】:

    标签: solr


    【解决方案1】:

    在 4.2 之前的 Solr 版本中,示例 schema.xml 中有一个 timestamp 字段,它实现了预定义的 date 字段类型

     <field name="timestamp" type="date" indexed="true" stored="true" default="NOW"      
          multiValued="false"/>
    

    这是日期字段类型定义

           <!-- The format for this date field is of the form 1995-12-31T23:59:59Z, and
             is a more restricted form of the canonical representation of dateTime
             http://www.w3.org/TR/xmlschema-2/#dateTime    
             The trailing "Z" designates UTC time and is mandatory.
             Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z
             All other components are mandatory.
    
             Expressions can also be used to denote calculations that should be
             performed relative to "NOW" to determine the value, ie...
    
                   NOW/HOUR
                      ... Round to the start of the current hour
                   NOW-1DAY
                      ... Exactly 1 day prior to now
                   NOW/DAY+6MONTHS+3DAYS
                      ... 6 months and 3 days in the future from the start of
                          the current day
    
             Consult the DateField javadocs for more information.
    
             Note: For faster range queries, consider the tdate type
          -->
        <fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>
    

    所以基于这个例子,我建议使用日期字段类型,注意它将以 UTC 格式存储。

    【讨论】:

    • 感谢您的宝贵支持但是,您弄错了。我有一个 cassandra 列族,在那个族中我有一个 column-name="Date_Time" type="timestamp"。现在,我如何将它索引到 solr schema.xml 中?solr 中是否有任何 fieldType 用于时间戳。根据你的说法,我的 schema.xml 将像这样 和 。但是很抱歉,它给出了错误。像这样.....当前验证类和 solrType 未找到列族:Date_Time。
    • 我展示的示例是在 Solr 中定义时间戳字段的标准方法。 “当前验证类和 solrType”错误不是您看到的标准 Solr 错误。我相信这与 DataStax Enterprise 有关。我建议在他们的支持论坛上发布一些东西 - support.datastax.com/home
    猜你喜欢
    • 2011-09-21
    • 1970-01-01
    • 1970-01-01
    • 2022-12-05
    • 2013-09-30
    • 1970-01-01
    • 2012-06-15
    • 2012-11-22
    • 2014-07-07
    相关资源
    最近更新 更多