SOLVED

KQL for Search

Highlighted
Visitor

We have a GITHUB search component - https://github.com/microsoft-search/pnp-modern-search

We are using  a Search Result Webpart connecting to SearchBox, it needs a KQL. 

Our requiremnt is, when we search a any term in searchbox, the search results should return all the documents which have title/filename having that word followed by files which have it in body. kind of prioritizing the titles over the body. This needs to search folders in specific library

 

This needs a KQL, we tried multiple combination of below but it doesnt return the files with title matching on the top

{searchTerms} XRANK(nb=3) title:({searchTerms}) XRANK(nb=1) body:({searchTerms}) -contenttypeid:0x0120* path:"DOCLIBPATH"

 

It would be great if anyone can help with it.

1 Reply
Highlighted
Best Response confirmed by Psai1986 (Visitor)
Solution

@Psai1986 replied on your github issue, and you should use cb and not nb as the boost parameter to have better control. Use the debug template to see the rank value changing.