The CreatorCon Call for Content is officially open! Get started here.

How to change the order of search results in portal?

Rajesh Mushke
Mega Sage

Hi All,

How to change the order of search results in portal?

PFB, now i want to change order of catalog results and KB article results. Catalog should be first and then KB articles.

 

find_real_file.png

 

Thanks,

Rajashekhar Mushke



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
13 REPLIES 13

The information I posted above, seemed to work perhaps before New York...now this works for sure...

So I was able to change it by going this.

For example...my search started like this when searching "Laptop":

find_real_file.png

So I want to change it to where catalog items show first, instead of knowledge articles...

Go to Service Portal > Search Sources, click "Knowledge Bases" search source, go to the "Data Fetch Script" section and do this change around line 66:

//article.score = result.meta.score;
article.score = -1000;

Now we try the search again:

find_real_file.png

 

Please mark reply as Helpful/Correct.

Please also mark any other reply as Helpful, if it was.

Thanks!

 

 


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Rajashekhar,

Let me know if you have any questions, but my reply should solve your question.

Please mark reply as Helpful/Correct and any other reply as Helpful, if so.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

It's been a bit since my reply was posted. I just wanted to check-in and see how things are going.

If my reply helped guide you correctly, please mark it as Helpful & Correct.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi @Rajashekhar Mushke 

It's been a bit over a year since my reply was posted. I just wanted to check-in and see how things are going.

If my reply helped guide you correctly, please mark it as Helpful & Correct.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Excellent, we have a custom search source (Cisco's website) and adding a line for the score = -1000 pushed it to the bottom of the list.

We wanted catalog items to be at the top, but maintain the original query score, so changed this line:

item.score = parseInt(sc.ir_query_score.getDisplayValue())+1000;

The "+1000" pushes the catalog items above the others.