2013-04-25 15 views
0

這裏我使用的是DSE-3.0.I想從索引欄索引=「時間戳」名稱=「日期時間」solr從cassandra數據庫。什麼應該是fieldType in類型=「timestamp」的solr中的schema.xml。請幫助我。我非常需要它。 謝謝 這是我的數據庫輸出: - cqlsh:mykeyspace> SELECT * FROM mysolr;索引欄類型=「時間戳」solr從卡桑德拉數據庫

KEY,124 | Date_Time,2013-02-11 10:10:10 + 0530 |身體,在每一個鍋裏的雞... |日期,1933年10月15日|名字,羅斯福|標題,爐邊聊天

但在查詢不給出Date_Time字段的值。 Solr中我的查詢輸出: - ID,身體,標題,姓名,日期 124,在每一個鍋雞... ...,爐邊談話,羅斯福, 「1933年12月15日」

我是什麼缺少configure.Please指導我正確的方式。謝謝。

回答

3

Solr中的之前的版本4.2有一個在示例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格式存儲。

+0

謝謝你的寶貴支持但是,你得到它的方式是錯誤的。我有一個cassandra列家庭,在那個家庭我有一個列名=「Date_Time」type =「timestamp」。現在,我如何索引它到solr schema.xml中嗎?sol​​r中是否有任何fieldType用於timestamp。根據你的我的schema.xml會是這樣的但遺憾的是,它提供了錯誤。像這樣.....當前驗證類和solrType找不到列族:Date_Time。 – user2306648 2013-04-27 06:25:18

+0

我已經展示的例子是在Solr中定義時間戳字段的標準方法。 「當前驗證類和solrType」錯誤不是標準的Solr錯誤,您會看到。我相信這與DataStax Enterprise有關。我會建議在他們的支持論壇上發佈一些內容 - https://support.datastax.com/home – 2013-04-29 12:18:30