Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
We used to add some rewritten values to the Examine Index to query it with Examine.
For example a datetime picker with name "date" we used to save to index as "dateRewritten" with the correct format to order it and query with ranges like this:
And().Range("dateRewritten", dateFrom, dateTo)
Now in Umbraco 8 we managed to get the dateRewritten correctly in the index, with _TransformingIndexValues event.
But when we now try to query on this field, and use .RangeQuery, we need to pass non nullable type, like long (we save ticks), but then an exception pops up:
: 'Could not perform a range query on the field dateRewritten, it's value type is Examine.LuceneEngine.Indexing.FullTextType'
Is there any way to do a RangeQuery on string field, like it was possible in U7?
How are you manipulating your "dateRewritten" field?
You will need to change it's type to a long in the index so you can do the range, this is the same as what was happening in v7 as you can't do range on text.
Assuming you are using the External Index you can do the following:
var externalIndex = examineManager.Indexes.FirstOrDefault(i=>i.Name == "ExternalIndex");
if(externalIndex != null)
externalIndex.FieldDefinitionCollection.AddOrUpdate(new FiledDefinition("dateRewritten", FieldDefinitionTypes.Long));
This can then be used to perform a ranged query against once you've populated it with the ticks value for the given date.
This was where I was looking for, thank you!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted