2
當我嘗試從我的索引中獲取10個最新結果(按日期遞減)時,我收到了舊文檔。它看起來像查詢需要10個過時的項目並對其進行分類。當查詢有許多結果時,我遇到這個問題。烏鴉空間索引錯誤排序結果DB
這裏是我的索引定義:
public class Home_ByCategoryTagAndLocation : AbstractIndexCreationTask<Home>
{
public Home_ByCategoryTagAndLocation()
{
Map = home => from n in home
from t in n.Source.CategoryTag
from c in n.Locations
select new { CategoryTag = t, n.DatePublished, _ = SpatialIndex.Generate(c.Latitude, c.Longitude) };
}
}
我使用此代碼調用我的索引:
public static List<Home> GetLatestHomeNear(IDocumentStore store, CityLocation location, int maxResults = 15)
{
if (location != null)
{
using (IDocumentSession session = store.OpenSession())
{
return session.Advanced.LuceneQuery<Home>("Home/ByCategoryTagAndLocation")
.WithinRadiusOf(radius: location.DefaultRadius, latitude: location.Latitude, longitude: location.Longitude)
.OrderByDescending(n => n.DatePublished)
.Take(maxResults)
.ToList();
}
}
return new List<Home>();
}