Hi,
I just upgraded from buid 400 something to 700 and a code that previously worked fine now has broken and after some research I found that it must be because of the swedish decimal delimiter (comma) instead of . (dot).
This is the code:
public class City_ByCountryCodeAndLocation : AbstractIndexCreationTask<City>
{
public City_ByCountryCodeAndLocation()
{
Map = Cities => from r in Cities
select new { r.CountryCode, _ = SpatialIndex.Generate(r.Position.Latitude, r.Position.Longitude) };
}
}
public static City FindCity(Position near)
{
using (var session = Db.Store.OpenSession())
{
var nearestCity = session.Advanced.LuceneQuery<City>("City/ByCountryCodeAndLocation")
.Where("CountryCode:SE")
.WithinRadiusOf(radius: 10, latitude: near.Latitude, longitude: near.Longitude)
.SortByDistance().Take(10).ToList().OrderByDescending(c=>
c.Region.Name).FirstOrDefault();
return nearestCity;
}
}
This is the error:
{
"Url": "/indexes/City/ByCountryCodeAndLocation?query=CountryCode%253ASE&start=0&pageSize=10&aggregation=None&sort=__distance&latitude=59%2C3389466&longitude=18%2C0572356&radius=10",
...
See that the %2C (comma) is removed in the illegal value 593389.
This might be an error from lucene, if so please resend this email to them, otherwise please add an InvariantCulture hint for the ToString method:
Convert.ToDouble(latitude,
CultureInfo.InvariantCulture)
For me, the problem is solved right now by temporarily switch to a different culture for the Thread:
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
Keep up the good work!
Best regards,
Christian Landgren, Iteam