332 Posts
Kenneth
9 years ago
6
Topic

Hello,

I've got a list & search type setup. Here I use the Search generic field to combine three fields.

The three fields are:

- Article title

- Article fulltext

- A keyword field i made to add extra keywords

What I want is for this search to putt the results that has the keyword in the Article title come first. But that just isn't happening.

How can I "prioritize" the search result so that it emphasizes article title first?

Get a VIP membership
9 years ago
1
Level 1

Hello Kenneth,

to order a search, you have two possibilities. 

When you edit your search type :

  1. in the tab "Ordering", you can put the field "title" and set the direction.
  2. Or in the tab "Search Form", you can add a field "Search Ordering". With that you will be able to let the user order like he want (demo)

Regards.

Lionel

332 Posts
Kenneth
9 years ago
0
Level 2

Hi Lionel,

Thanks for replying. 

I've already done what you suggested, but it still dosn't prioritize title over full text in search.

I want results with keyword in article title to be placed above results with keyword in fulltext. Is there no way of setting such a prioritazion/weighting?

9 years ago
2
Level 1

Hi Kenneth,

In order to more understand this

What I want is for this search to putt the results that has the keyword in the Article title come first. But that just isn't happening.

Can you give us an example?

Regards,
Mehdi.

332 Posts
Kenneth
9 years ago
1
Level 2

Sure, have a look at this screenshot. I would like to have the number #2 result be #1 because of the keyword in the title. But it seems there is no way to make it prioritize title in front of full text?

332 Posts
Kenneth
9 years ago
0
Level 3

9 years ago
0
Level 1

Hello Kenneth,

thank for the screenshot.

I think it's possible by using the plugin field Query for writing the query manually, so like that you can use a case in the order :

..
.....
ORDER BY 
    CASE 
        WHEN [MATCH]title||$uri->getValue('search_field')[/MATCH] THEN 0 
        WHEN [MATCH]fulltext||$uri->getValue('search_field')[/MATCH] THEN 1 
    END ASC

Regards.

Lionel

Get a VIP membership