Boosting Title/DocumentName field in Pages/Pages Crawler Index

Michael Legacy asked on October 31, 2019 18:07

Does Kentico have any way to boost fields without building my own custom indexer? I would like to slightly boost title over content, since some pages are scoring higher due to referencing certain documents multiple times.

For example a page title "Cancer Center" is scoring 3rd, whereas a page called "Breast Cancer" that has "Cancer Center" in it's content multiple times is scoring 1st.

I would prefer titles to get preference over content, as it's the most common thing people will be searching for.

I would prefer not to build a custom indexer if I don't have to, but if there was a way to duplicate the functionality of the standard Pages / Pages Crawler indexer and just alter it slightly to include the boost, that's an option, too.

Recent Answers


Dmitry Bastron answered on October 31, 2019 19:11

Hi Michael,

Apparently, Kentico does not include DocumentName field for Page Crawler indexes. But it can include page type custom fields, if they are marked as "Searchable" in "Search fields" of a specific page type. It means, you can add your custom Title field for all searchable page types (i.e. via base page type), make it searchable and then you'll be able to boost the search by it by just using typical Lucene syntax (title:somevalue)^2

0 votesVote for this answer Mark as a Correct answer

Michael Legacy answered on October 31, 2019 20:02

Dmitry, I'm back to just using the Pages indexer, is DocumentName included there? That would be very weird if DocumentName was not indexed....

But regardless, does this method you've shown above act as a filter (IE only includes results with documents that are titled "X") or does it just raise the score of that field? I don't want it to act as a Field filter, just a way to boost that field specifically.

I'll mess around in Luke and see if I can find the answer before you get to this.

Thanks for the answer!

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on November 1, 2019 15:12

No, it works as a filter, but you can combine a few in the following query:

(title:coffee)^10 or (_content:coffee)

Assuming you have a custom "title" field, this quesry will return everything with "coffee" in title or content but will boost 10 times when it is in the title.

0 votesVote for this answer Mark as a Correct answer

Michael Legacy answered on November 1, 2019 15:56

Pages crawler does not appear to include DocumentName either. Anyway I can easily include this? I don't have the a secondary custom field for the page name/title and creating one on 1,000 pages is really not an option at this point.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on November 1, 2019 16:48 (last edited on November 1, 2019 16:49)

To be honest, I haven't found a way to include DocumentName into index. This is unfortunate, but maybe if you reach support (support@kentico.com) they could shed some light on it.

But adding a requred Title field for the existing Page Type shouldn't be hard. I see these steps required:

  • In your Page Type add a new string field called Title and mark it as required
  • In SQL run the following update to copy existing DocumentTitle into new Title field:

Code example for Dancing Goat MVC, Article Page Type and new Title column:

UPDATE
    DancingGoatMvc_Article
SET
    DancingGoatMvc_Article.Title = View_CMS_Tree_Joined.DocumentName
FROM 
    View_CMS_Tree_Joined
    INNER JOIN DancingGoatMvc_Article 
        ON View_CMS_Tree_Joined.DocumentForeignKeyValue = DancingGoatMvc_Article.ArticleID
WHERE View_CMS_Tree_Joined.ClassName = 'DancingGoatMvc.Article'
  • (optional) And to avoid field duplication, in Fields tab of your Page Type you can select new Title field in the dropdown "Page name source field". That's it!
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.