I may have stumbled onto a bug with static indexes - but there is a workaround.
In my project I am indexing a string field, this field can be a number, text, a date, or pretty much anything. The problem happens if its a date!
If I save the following object into RavenDB
{
AnalyzerId {c0273147-2816-4d44-a7db-2f2e14bc73fd} System.Guid
Bucket "2015-08-31T23:32:00-05:00" string
BucketId {ce6dd8c1-08b3-4e38-99ef-6392f5fe4ebe} System.Guid
Data 9 double
Id {20632dfe-1af1-4bf8-906d-7cd90d4cd16b} System.Guid
Stamp {8/31/2015 11:32:09 PM} System.DateTime
}
With the following static index defined:
Map = buckets => from b in buckets
select new
{
Id = b.Id,
AnalyzerId = b.AnalyzerId,
Stamp = b.Stamp,
Bucket = b.Bucket,
BucketId = b.BucketId
},
Indexes = {
{ x => x.Bucket, FieldIndexing.NotAnalyzed },
{ x => x.BucketId, FieldIndexing.NotAnalyzed },
{ x => x.AnalyzerId, FieldIndexing.NotAnalyzed }
}
The index is populated with AT FIRST seems like correct data - but if you take a look at the terms under the index in the web client, the value of BUCKET is listed as "2015-08-31T23:32:00.0000000-05:00"
Which might be logically equal to what I saved, but not exact - causing a later query for "2015-08-31T23:32:00-05:00" to return no results :(
I think obviously RavenDB is automatically analyzing the input and determining its a date and formatting it appropriately, but I do need to be able to query for what I saved and get results!
The workaround I've done at the moment is to convert the string I am saving into DateTime ticks instead of a ISO string. So I send along a long number string instead of a date string - this allows me to query for the value later but I hope this is fixed in a future version
Thanks