Limiting data that is returned from Smart Search Results

Jacob Mallach asked on March 6, 2018 22:36


I'm needing some guidance with Kentico search. I've already read a good number of articles and feedback in trying to find solutions with no success. Here is the scenario that I'm trying to achieve.

  1. User inputs some text into the search field and submits
  2. search results should give precedence to the returned results in the following order
  3. page url
  4. page title
  5. page/body content

The returned results list would first show any/all page url matches. Next any/all page title matches. And finally page/body content matches.

We have search setup currently on our site and working. The need is with customizing the results. I've tried boosting, but I think the issue is with the index as I'm unable to control precisely what data is returned.

Is this possible?

Thanks for the help.

Correct Answer

Dragoljub Ilic answered on March 7, 2018 10:05

Hi Jacob,

Did you tried something like this, with boosting some fields that you want? You can add this in search condition field in kentico web part:

nodealiaspath: ({% QueryString.searchtext %})^0.3

I think this will boost pages that contains search text in nodealiaspath(url), title and content with different coefficient which will affect on ordering items in search list. You can find more info in this article

NOTE: Maybe you should add wildcard characters for lucene to make this work (depends how your search result is currently working) and to modify coefficient how ever suits you best.

Best regards, Dragoljub

0 votesVote for this answer Unmark Correct answer

Recent Answers

Jacob Mallach answered on March 7, 2018 21:11 (last edited on March 8, 2018 00:00)

Hi Dragoljub,

Thanks for the help. The kentico event log throws me the following error after implementing your code.

Message: Cannot parse '+_culture:([en-us TO en-us] [invariantifieldivaluei TO invariantifieldivaluei]) title: ()^2
nodealiaspath: ()^0.5
content: ()^0.3': Encountered " ")" ") "" at line 1, column 88.
Was expecting one of:
"+" ...
"-" ...
"(" ...
"*" ...
"[" ...
"{" ...
"*" ...


Update: Installed the Luke - Lucene Tool which was very helpful to target the correct index properties. Coupled that tool with your suggestion and things are beginning to tighten up. Thnx!

0 votesVote for this answer Mark as a Correct answer

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