Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > controlling the smart search box default sort? View modes: 
User avatar
Member
Member
matt-awg - 1/17/2013 8:47:37 AM
   
controlling the smart search box default sort?
In the master page of the site I am working on, in the header there is a Smart search box. It takes you to a search results page which has a smart search dialogue, smart search filter and a smart search results web part. This is all working correctly except I can't seem to control the sort from the first search a user does using the search box in the header. If I change the smart search results web part's "Search results order" property, this works when the page first loads, but it seems like it causes problems with using the smart search filter on the search page if the user does another search from the search results page. I think it is always first sorting by the smart search results web part's "Search results order" property and then adding to the sort what ever the user selected from the smart search filter. I can't seem to find a way to specify the default sort in the "Smart search box" in the header so I am not sure how to make this work. Any ideas on how to do this would be greatly appreciated!

Thanks,
Matt

User avatar
Certified Developer 13
Certified Developer 13
josefd@kentico.com - 1/18/2013 10:09:56 AM
   
RE:controlling the smart search box default sort?
Hello,

The Search results order property should not be set, if Search filter web part has been used for ordering. The Search results web part will use the first sort option listed in the search filter web part as default sort order, even if the search had been made from a different page.

Regards,
Josef Dvorak

User avatar
Member
Member
matt-awg - 1/21/2013 8:07:09 AM
   
RE:controlling the smart search box default sort?
Thank You Josef,
so in the smart search filter -> filter properties -> values, if I put:
##SCORE##;;By relevance

first - then even if the user did not select it because they did not actually search from this page, it will default to sorting by relevance? I did a quick test and it does seem to work that way.

One more related question, what (if anything) can you do to further refine the sort order. Meaning when two items have the same "##SCORE##" then what decides which comes first in the results? Is there a way to control that?

Thanks again!
Matt

User avatar
Certified Developer 13
Certified Developer 13
josefd@kentico.com - 1/22/2013 3:22:59 AM
   
RE:controlling the smart search box default sort?
Hello,

The Smart Search uses order by ##SCORE## as default, even if no filter is set. Try testing it with a different rule, for example "documentcreatedwhen;;Creation date", to see if you get a different order of results.

To use multiple sort options, simply put a column between the two. For example:

documentcreatedwhen;;Date (Default)
##SCORE##;;Score
##SCORE##,documentcreatedwhen;;Score & Date


Hope this helps.

Regards,
Josef Dvorak