Tuesday, March 8, 2016

Sitecore Lucene search all documents have the same score of 1

I spent a bit of time banging my head against the wall when my Sitecore Lucene search was returning all documents with the score of 1. Even with boosting on key fields, less relevant documents were appearing first (because they all had the same score).

In this particular case the issue was the when building the search query I was using filter instead of where.
var searchResults = searchContext.GetQueryable<SearchModel>().Where(searchPredicate);
 would be correct instead of:
var searchResults = searchContext.GetQueryable<SearchModel>().Filter(searchPredicate);

No comments:

Post a Comment