Get Unified Weights settings from index

Vote:
 

Hi,

How can I get settings from 'Boosting' tab programatticaly?

Best regards,

Pavel

#142164
Dec 03, 2015 8:58
Vote:
 

I think you should be able to access them using:

SearchClient.Instance.Conventions.AutoBoostConvention

You can also set them using conventions:

client.Conventions.ForInstancesOf<BlogPost>()   .SetDecayParameters(....)
#142184
Dec 04, 2015 8:28
Vote:
 

Actually, AutoBoost is used for document age and popularity, and not for the unified weights.

Here is a way to get the unified weights:

            var unifiedWeightsQuery =   
                SearchClient.Instance.NewCommand(context => new UnifiedWeightsCommand(context, SearchClient.Instance.DefaultIndex));

            UnifiedWeightsItem weights = unifiedWeightsQuery.Execute().Hits.FirstOrDefault();
#142187
Edited, Dec 04, 2015 9:01
Vote:
 

Nice one, @Per Magne! :)

#142188
Dec 04, 2015 9:24
Vote:
 

Hi Per Magne Skuseth,

Thanks for your solution

Is it possible to set weight to another property from UnifiedSearchHit (e.g. Section or Subsection)?

We can setup some values only for SearchTitle, SearchText, SearchSummary and SearchAttachment from UI boosting tab.

#142228
Dec 04, 2015 21:43
Vote:
 

@Pavel, instead of using UnifiedSearchFor, you could do:

.UnifiedSearch().For(q)
                    .InField(x => x.SearchSection,2)    

and then add additional fields. You can then specify whatever boosting you would like - "2" in this case for SearchSection

#142328
Dec 09, 2015 11:01
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.