0

This question already has an answer here:

I'm on Solr 4.10.4, Sitecore 8.1 160519.

I have a custom index defined the following way:

<field fieldName="date_of_birth" returnType="datetime" type="MyProject.Search.ComputedFields.ParsedDateOfBirth,MyProject.Search">
    <name>date of birth</name>
</field>

I make sure that the "ParseDateOfBirth" returns a valid date - I tried with both a DateTime object or a string - and in either case I get the following result after inspecting the index with Luke:

enter image description here

What am I doing wrong?

marked as duplicate by Mark Cassidy Feb 16 at 17:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Can you share a code snippet of how you are populating the computed field? – Dan Sinclair Feb 15 at 20:00
  • 1
    The default item created date is like this <field fieldName="__smallcreateddate" returnType="string" >Sitecore.ContentSearch.ComputedFields.CreatedDate,Sitecore.ContentSearch</field>. Perhaps just store it as string? – Mark Gibbons Feb 16 at 9:38
2

This is expected behavior. You are looking at it in Luke. SOLR encodes the datetime fields so it can handle sorting/filtering in a better way than pure Lucene. If you look at the an item in the SOLR viewer, with a date field. You will find the date is perfect.

I asked the same question a little while ago. The issue is don't look at Luke. Look at the SOLR viewer.

SOLR datetime fields not readable

Not the answer you're looking for? Browse other questions tagged or ask your own question.