2012-08-10 4 views
2

색인에서 최신 결과 (oder by date desc)를 취하려고하면 오래된 문서가 나타납니다. 쿼리가 10 개의 오래된 항목을 가져 와서 정렬하는 것처럼 보입니다. 쿼리에 많은 결과가있을 때이 문제가 있습니다.Raven 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의 정상적인 동작을 설명하는 것으로 보인다

여기 내 인덱스 정의입니다.

이것은 공간 인덱스와 전혀 관련이 없습니다. 그것은 단지 부패한 색인 일뿐입니다.