0

在这里我使用 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,body,title,name,date 124,A chicken in every pot ...,炉边聊天,Roosevelt,"dec 15, 1933"

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

4

1 回答 1

3

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

 <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 格式存储。

于 2013-04-25T15:42:12.703 回答