Examine and boosting by frequency of a word in a field
Hi
Does anyone know how to boost the score of a result, base on the number of times a certain term/word occurs in a certain field?
So if we search "bottle" and "bottle" occurs 30 times in the field "bodyText" in a document, I would like it to boost that document by 0.05f per occurrence.
var fieldList = new List<string> { "seoTitle", "header", "seoMetaDescription", "seoMetaKeywords", "bodyText", "bodyContent", "leadText" }
if (ExamineManager.Instance.TryGetIndex("ExternalIndex", out var index))
{
var query = "";
foreach (var field in model.SearchFields)
{
foreach (var term in model.SearchTerms)
{
if (field == "bodyText" || field == "bodyContent")
{
query += "(" + field + ": " + term.ToLower() + "^0.2)";
}
else
{
query += "(" + field + ": " + term.ToLower() + ")";
}
}
}
var queryContent = index.GetSearcher().CreateQuery().NativeQuery(query);
var resultContent = Current.PublishedContentQuery.Search(query: queryContent);
}
Examine and boosting by frequency of a word in a field
Hi
Does anyone know how to boost the score of a result, base on the number of times a certain term/word occurs in a certain field?
So if we search "bottle" and "bottle" occurs 30 times in the field "bodyText" in a document, I would like it to boost that document by 0.05f per occurrence.
is working on a reply...