0
votes

Here i am using DSE-3.0.I want to index column type="timestamp" name="DateTime" in solr from cassandra database.What should be the fieldType in schema.xml in solr for type="timestamp".Please help me.I have badly need it. Thank you This is my database output: -- cqlsh:mykeyspace> SELECT * FROM mysolr ;

KEY,124 | Date_Time,2013-02-11 10:10:10+0530 | body,A chicken in every pot ... | date,dec 15, 1933 | name,Roosevelt | title,fireside chat

But at query not gives value of Date_Time field. My query output in solr is :-- id,body,title,name,date 124,A chicken in every pot ...,fireside chat,Roosevelt,"dec 15, 1933"

What am i missing to configure.Please guide me proper way. Thank you.

1

1 Answers

3
votes

In versions of Solr prior to 4.2 there was a timestamp field in the example schema.xml that implemented a predefined date fieldType

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

Here is the date fieldType definition

       <!-- 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"/>

So based on this example, I would recommend using the date field type, noting that it will be stored in UTC format.