U4-2908 - Examine IndexSet: field with "double" type don't works

Created by Flavio Spezi 21 Sep 2013, 23:15:59 Updated by Shannon Deminick 21 Jun 2017, 07:58:15

This is my first experience with Examine. Then I'm working with one eye in Examine source code to better understand what it can do for me and what it need by me.

I am add an IndexSet in config/ExamineIndex.config like this:

<IndexSet SetName="MyIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/MyIndexSet>

I add also a Indexer and Searcher in config/ExamineSettings.config:

It is all ok. I can search correctly.

The issue starts when I change the type of geoCoordinates fields:

The issue is this: Examine is not more able to index data. Before setting Type of fields, the IndexSet contains 600 nodes. After, IndexSet is empty.

I set these fields with a code like this:

rowData.Add("geoCoordinate_latitude", latitudeValue.ToString()); rowData.Add("geoCoordinate_longitude", longitudeValue.ToString());

I look the code inside Examine. I found the method TryConvert that converts a string to another value, like Int, Double, DateTime. The issue is that the line with (T).tc.ConvertFrom(val) don't indicates the cultureInfo argument with InvariantCulture.

My local PC and my local server uses Windows in Italy culture, so my decimal separator is , instead of ..

Then if I change the code to set fields with a Replace I can look that Examine works correctly:

rowData.Add("geoCoordinate_latitude", latitudeValue.ToString().Replace('.', ',')); rowData.Add("geoCoordinate_longitude", longitudeValue.ToString().Replace('.', ','));

I don't understand because the ToString method returns the value with . as decimal separator. Maybe because the thread that runs uses English as CurrentCulture (System.Globalization.CurrentCulture). But this strange result say to me that Examine runs in a thread with Italian culture. That's for sure.

When I will terminate my project, it will go online, in a american server. So the trick I used above must be removed.

The best solution for me (and also for the Umbraco community) is to verify any conversion from-to string and set cultureInfo argument with the magic invariantCulture. In Examine project and Umbraco-CMS project. (look this https://github.com/umbraco/Umbraco-CMS/pull/120 )

If you need help or advice, I am at your disposal. I am Italian, so I have a lot of experience with conversions of values (datetime, decimal) ​​to / from string to / from javascript / c# / sql, because my customers speaks a language other than computers.

Thanks

Comments

Shannon Deminick 21 Jun 2017, 07:58:15

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/


Priority: Normal

Type: Bug

State: Closed

Assignee: Shannon Deminick

Difficulty: Normal

Category: Localization

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.5

Due in version:

Sprint:

Story Points:

Cycle: