API
Version 7.x > API > Smart Search - Field Boost View modes: 
User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/1/2013 12:50:06 PM
   
Smart Search - Field Boost
I've created my own Custom Search Index referencing:
http://devnet.kentico.com/Videos/System-Management/Smart-Search-in-Kentico-CMS-6.aspx
http://devnet.kentico.com/docs/devguide/index.html

I have fields: Title and Description. I tried to boost the ranking for a term match in the Title field using Lucene's "field.SetBoost(2f)", but found it not to impact the results. I would like to use the field boost with other columns as well to affect the search rankings.

The only way I could get it to work was modifying the kentico source code search method replacing:
QueryParser queryParser = new QueryParser("_content", a);

with
var queryFields = new string[] { "_customtitle", "_content" };
QueryParser multiQuery = new MultiFieldQueryParser(queryFields, a);

I'm not very experienced with Lucene. Is there a way to accomplish field boosting without modifying the source code?

Thanks,
Jason

User avatar
Certified Developer 11
Certified Developer 11
jellison - 8/1/2013 3:17:21 PM
   
RE:Smart Search - Field Boost
I guess one work-around would be to modify the searchText in the SearchResults webpart behind the scenes after the user submits the form:
searchText="cheese lions"

transformed to:
_customtitle:("cheese", "lions")^3 and _content:("cheese","lions")

where ^3 is the boosting value.