I've been playing around with the RavenDB Northwind database, and am having trouble getting orders sorted by Freight.
My index:
Map = orders => from o in orders
select new {
o.Freight
};
IndexSortOptions.Add(x => x.Freight, SortOptions.Double);
Indexes.Add(x => x.Freight, FieldIndexing.NotAnalyzed);
My query:
return sess.Query<Order>("Orders/ByFreight")
.OrderByDescending(x => x.Freight)
.Select(x => x.Freight);
It get the following order back:
[
32.38,
11.61,
65.83,
41.34 ... ]
Which is clearly not correct. In the studio, I can define the order to be by Freight, and it orders just fine. However, if in the studio I specify the range as over Freight_Range, I get these same results back. It appears to me that Raven is selecting the Freight_Range field to sort by rather than the Freight field. Why?