Sitecore 搜索顺序

Sitecore Search Orderby

当按字符串字段排序时,我发现 Sitecore 7.1 搜索有一个非常奇怪的行为。代码是这样的:

var indexableItem = new SitecoreIndexableItem(Sitecore.Context.Item);
var searchIndex = ContentSearchManager.GetIndex(indexableItem);
var context = searchIndex.CreateSearchContext();
var results = new List<Item>();
var count = 0;
var totalSearchResults = 0;

var contactColleagues = context.GetQueryable<SearchResultItem>()
    .FirstOrDefault(x => x.ItemId == Sitecore.Context.Item.ID);

if (contactColleagues != null)
{
    var items = contactColleagues.GetDescendants<ColleagueSearchResultItem>(context)
                                 .Where(x => x.TemplateId == Templates.Colleague);

    items = items.OrderBy(x => x.Surname);

    var resultItems = items.Page(this.PageNumber, PageSize).GetResults();
}

这一切都按预期工作,returns 我的数据集按预期按姓氏排序。直到出现一个姓 "Or" 的人。现在 Sitecore returns 这个人的名字在列表的开头,无论我们做什么。

经过一些测试,我发现如果我决定打电话给某人 "Andy And",也会出现同样的问题,这会出现在 "Jeff Aardvark" 之前的列表中。

我假设这是将数据呈现给 Lucene 索引的方式中的错误。

有没有人遇到过这个问题,或者对如何解决这个问题有任何想法?

提前致谢。

如果您使用 Luke (https://code.google.com/p/luke/) 查看索引中的姓氏字段,该值是否为空?听起来有潜在危险的查询值在索引级别或从索引加载时被删除。

我认为您对停用词有疑问。默认分析器会在抓取项目时删除它们。但是,您可以防止这种行为。

此 post 解释了如何关闭停用词过滤器:

http://blog.horizontalintegration.com/2015/01/08/sitecore-standard-analyzer-turn-off-the-stop-words-filter/