BC Digi
10/13/2023, 11:49 AMpublic class ConfigureIndexOptions : IConfigureNamedOptions<LuceneDirectoryIndexOptions>
{
public void Configure(string name, LuceneDirectoryIndexOptions options)
{
...
options.FieldDefinitions.AddOrUpdate(new FieldDefinition("estatePrice", FieldDefinitionTypes.Long));
...
}
}
This field is filled with a value in UmbracoContextIndex_TransformingIndexValues
private void UmbracoContextIndex_TransformingIndexValues(object sender, IndexingItemEventArgs e)
{
...
dictionary.Add("estatePrice", new List<object> { decimal.ToInt64(estateComposition.Price) });
...
}
Everything looks fine, my values are present in the indexes.
But when I try to search this field with a range query
queryBuilder.And().RangeQuery<float>(new[] { "estatePrice" }, intMin, intMax);
I keep getting the error:
System.InvalidOperationException: 'Could not perform a range query on the field estatePrice, it's value type is Examine.Lucene.Indexing.FullTextType'
What am I missing? Or is there another possible way to search a range with Examine?
Thanks for any help.
https://cdn.discordapp.com/attachments/1162356497603366952/1162356497775337513/image.png?ex=653ba3d8&is=65292ed8&hm=c357e4e407918461dbdc3a0830e1ada3a8dd0537ec2f0ca3840c665ece5c5318&
https://cdn.discordapp.com/attachments/1162356497603366952/1162356498022793287/image.png?ex=653ba3d8&is=65292ed8&hm=b55c5ccb2ed8347c54eededa73a2e84634a57a59ccc4ec44eb6fd887e2c892f0&D_Inventor
10/13/2023, 11:57 AMMike Chambers
10/13/2023, 12:33 PMpublic class ExamineIndexOptionsComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
// Custom Examine configuration
builder.Services.ConfigureOptions<ConfigureExamineIndexOptions>();
}
}
and also rebuild your indexes?BC Digi
10/17/2023, 5:27 AMpublic void Configure(string name, LuceneDirectoryIndexOptions options)
{
if (name != Constants.UmbracoIndexes.ExternalIndexName) return;
options.FieldDefinitions.AddOrUpdate(new FieldDefinition("estatePrice", FieldDefinitionTypes.Long));
options.FieldDefinitions.AddOrUpdate(new FieldDefinition("estateImportCreateDateTime", FieldDefinitionTypes.Long));
}
Both are longs, the other field is used for sorting and does not give errors.
queryBuilder.OrderByDescending(new SortableField("estateImportCreateDateTime", SortType.Long));
So I can assume that the code executed.BC Digi
10/17/2023, 5:38 AM