1

I am changing the search engine from lucene to solr , and i want to make config changes in my custom indexes , i am using the search_keywords field for the predictive search , and the field is also boosted in lucene ,

<fieldMap ref="contentSearch/indexConfigurations/defaultLuceneIndexConfiguration/fieldMap">
            <fieldNames hint="raw:AddFieldByFieldName">
              <field fieldName="search_keywords" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
                <analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
              </field>
            </fieldNames>
          </fieldMap>

I want to know that how the same boosting will occur in solr , what changes i have to make?

Any suggestion would be appreciated.

1 Answer 1

0

You can boost result at the time when you are getting result. Below are the code :

var filters = new HashSet<Expression<Func<ContentPageSearchModel, bool>>>();
var expression = BuildSearchExpression("searchtext");
filters.Add(expression);

Expression<Func<ContentPageSearchModel, bool>> BuildSearchExpression(string text)
        {
           var namePredicate = PredicateBuilder.True<ContentPageSearchModel>();
            return namePredicate.Or(item => item.Name == text).Boost(3.0f);
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.