We're using the content search api to search through our Azure Search index, everything works fine but boosting does not work. However, when we switch from Azure search provider config to the Lucene search provider config boosting works, so we think it's because of azure.
The Content Search Code:
var tags = GetTagsFromSomewhere();
using (var context = SearchIndexResolver.GetIndex(ContextItem).CreateSearchContext())
{
var queryable = context.GetQueryable<CustomType>();
var predicat = PredicateBuilder.False<BaseIndexModel>();
foreach (var tag in tags)
{
predicat = predicat.Or(q => q.Tags.Contains(tag).Boost(1.5f));
}
queryable = queryable.Where(predicat);
var results = queryable.GetResults();
}
Azure Search Config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultCloudIndexConfiguration type="Sitecore.ContentSearch.Azure.CloudIndexConfiguration, Sitecore.ContentSearch.Azure">
<fieldMap type="Sitecore.ContentSearch.Azure.FieldMaps.CloudFieldMap, Sitecore.ContentSearch.Azure">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="tags"
storageType="YES"
indexType="UNTOKENIZED"
vectorType="NO"
type="System.Collections.Generic.List`1[[System.String, mscorlib]]"
boost="1f"
settingType="Sitecore.ContentSearch.Azure.CloudSearchFieldConfiguration, Sitecore.ContentSearch.Azure" />
</fieldNames>
</fieldMap>
</defaultCloudIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
Lucene Search Config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<contentSearch>
<indexConfigurations>
<defaultLuceneIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
<fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
<fieldNames hint="raw:AddFieldByFieldName">
<field fieldName="tags"
storageType="YES"
indexType="UNTOKENIZED"
vectorType="NO"
type="System.String"
boost="1f"
settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" />
</fieldNames>
</fieldMap>
</defaultLuceneIndexConfiguration>
</indexConfigurations>
</contentSearch>
</sitecore>
</configuration>
I'm very confused as to why boosting doesn't work, even though the search code used is the same and as far as I'm aware both configs are more or less the same so does anyone know why Azure search boosting doesn't work
Any help would be appreciated thanks :)