-
-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Peculiar exception on long range query - field type claims to be FullTextType when it is explicitly set to Long #208
Comments
Are these related? Examine Search Range Query error on Date Time |
Examine supports DateTime OOTB you don't need to jump through hoops to make that work and using Ticks is a very old way of doing things. There's some docs here for doing Date range queries https://shazwazza.github.io/Examine/searching.html and there's plenty of examples in the source code: https://github.com/Shazwazza/Examine/blob/master/src/Examine.Test/Search/FluentApiTests.cs You need to configure your fields to be the correct value type (just like a database). By default everything is simply Full Text but if you want numerical, date, etc... type fields you need to define them that way. There's some docs here about modifying field types https://shazwazza.github.io/Examine/configuration.html and also in Umbraco docs too: https://our.umbraco.com/Documentation/Reference/Searching/Examine/indexing/#changing-field-value-types |
You've mentioned this is an issue only in one of your environments which, perhaps your custom code isn't executing in that environment or some other code is switching it back? |
How to configure the field type using this document https://shazwazza.github.io/Examine/configuration.html? |
@Shazwazza in Umbraco v10.2.1 I have something like this:
and
However if I use
I guess it should have a I raised a new issue regarding this here: #314 |
Background
We want to query on a date range. We have read that the way to do that is by using the DateTime Ticks. We have set up code for adding the field definition and setting the value set on the index. When executing the querying code, it works as expected in our local development environment. But when the same code is running on the live environment it throws an InvalidOperationException. So, we can't actually reproduce this. Even after setting up our local development environment to mirror the live environment as closely as possible; restoring the database and copying the index.
Our setup
Examine version: 1.0.6
Umbraco version: 8.11.1
In the startup of the project we are running
index.FieldDefinitionCollection.AddOrUpdate(new FieldDefinition("sortDate_sv-se", FieldDefinitionTypes.Long));
Then we are running the following to index the field:
indexingItemEventArgs.ValueSet.Set("sortDate_sv-se", sortDate.Ticks);
The query
In a query we are running
query = query.And().RangeQuery<long>(new[] {"sortDate_sv-se", DateTime.MinValue.Ticks, DateTime.Now.AddDays(-1).Ticks)
The exception
When executing the query
What we've tried
The text was updated successfully, but these errors were encountered: