Search code examples
lucenesitecoresitecore7

Search Results Sort order using Sitecore 7 ContentSearch API?


I am using the Sitecore.ContentSearch API to perform a search which works fine and brings back the expected results.

searchResults = context.GetQueryable<SearchItem>()
    .Where(i => i.Name.Contains(searchTerm));

I have then added a Boosting Rule at /sitecore/system/Settings/Indexing and Search/Boosting Rules/Item Rules which checks a boolean value on the item and if its true boosts the score, the rule has been applied via Standard Values on the Item template.

The issue I have is the order of the results returned from the GetQueryable call do not match the results I am expecting.

If I run the same query in Luke v3.5 I get the expected results back ordered by the Score desc.

Does anyone know why the call to GetQueryable results would be in a different order?

Update - Additional Rule Details

Rule

enter image description here

Item Template

enter image description here


Solution

  • Sitecore support have come back with the use of boosting is not supported when using Contains in Linq as this constructs a Wildcard Query in Lucene which does not support boosting.

    Its discussed in a bit more detail here