최근에 Sitecore 6.6으로 업그레이드했으며 Lucene의 검색 및 크롤링 기능에 문제가 발생했습니다. 6.6은 새로운 버전을 사용하고 일부 메소드/기능이 더 이상 사용되지 않아서입니다.Sitecore 6.6 및 Lucene 업그레이드 문제
아래의 코드는 이전 버전의 Lucene.NET 2.3에서 제대로 작동하는 데 사용되었지만 2.9에서는 작동하지 않습니다. 우리가 뭘 잘못하고 있는지 알려주고이 코드를 수정하는 데 도움이 될 수 있습니까? 컴파일 중 오류가 발생했습니다
`Lucene.Net.Search.IndexSearcher` does not contain a definition for 'Search'
and no extension method 'Search' accepting a first argument of type
`Lucene.Net.Search.IndexSearcher` could be found (are you missing a using
directive or an assembly reference?)
이 오류는이 줄에서 발생합니다 - Sitecore.Search.SearchHits hits = new SearchHits(context.Searcher.Search(query,sort));
. 나는 그것이 간단한 수정 일 것이라고 짐작하지만, 그것을 고치는 방법을 확신하지 못한다.
private static SearchResultCollection GetSearchResults(Query query, Sort sort, int startingIndex, int getCount, out int totalHits)
{
SearchResultCollection retVal = new SearchResultCollection();
Sitecore.Search.Index searchIndex = Sitecore.Search.SearchManager.GetIndex("content");
using (Sitecore.Search.IndexSearchContext context = searchIndex.CreateSearchContext())
{
Sitecore.Search.SearchHits hits = new SearchHits(context.Searcher.Search(query,sort));
totalHits = hits.Length;
//since index is zero based... adjust the numbers
startingIndex = (startingIndex - 1) * getCount;
getCount = (getCount > totalHits || totalHits < startingIndex + getCount)
? hits.Length - startingIndex : getCount;
retVal = hits.FetchResults(startingIndex, getCount);
}
return retVal;
}
감사
변경했습니다. 구멍에 불이났다! :) – Gabbar
코드에서 다음 오류가 나타납니다 - prefixCode 문자열의 잘못된 시프트 값 (인코딩 된 값은 실제로 INT입니까?) – Gabbar
모든 스택 추적? 그냥 구글에서 당신과 그의 대답이 같은 문제가있는 사람이 "나는 숫자 필드에 대한 색인을하지만 내 Sortfield는 플로트로 설정되었다"발견했다. –