2012-08-10 67 views
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>(); 
} 

回答

0

这个职位似乎描述的stale indexes正常行为。

这与空间索引完全没有关系。这恰好是陈旧的索引。