Skip Navigation

[Resolved] Archieve search result sorted by meta key does not work if relevanssi activated

This support ticket is created 5 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 12 replies, has 3 voices.

Last updated by Nigel 5 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#1277447

I am trying to: displaying search result order by meta key

Link to a page where the issue can be seen:

I expected to see:5, 4, 3, 2, 2

Instead, I got:3,4,2,5,2

Hello I created custom field mynumber and attached to standard post type post. I am using relevanssi plugin for search.

I need search result order by meta key mynumber in descending order.

i created function to sort search result with meta key

function func_reli($qry){
$qry->set('orderby', 'meta_value');
$qry->set('meta_key', 'wpcf-mynumber');
$qry->set('order', 'DESC');
return $qry; //
}
add_filter('relevanssi_modify_wp_query', 'func_reli');

working fine............

But it does not work with toolset wordpress archieve- search result. If i display search result with wordpress archieve- search result. it does not sort search result.

you can see: hidden link

#1277463
test field.png

Attachment

#1277631

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-06-26 at 14.09.50.png

If you are using Relevanssi then it controls the order of results, not Views, ordering them by its assessment of relevancy.

There is a notice in the admin which explains that.

I'd say you know that already.

I'm not sure—I can't tell without digging very deep into the Views source code—how the interplay between Views and Relevanssi works on an archive page. We don't have an API filter for archives to modify/inspect the query arguments in the same way that we have for Views themselves (wpv_filter_query) to compare what the Relevanssi filter describes and what an equivalent Views filter would describe.

I'm setting up a site to test—Relevanssi is taking a good while to index the content—where I can at least confirm what you describe.

I'm not sure if I'll have a solution for you, but I look into it once my test site is up and running.

#1278079

Ok. waiting.........

#1278177

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I can confirm the problem on my test site, but can't see why.

Views states that it doesn't affect the ordering on custom archives when Relevanssi is used, but it clearly does in some way.

I've escalated this so that my second tier colleagues can take a deeper look, and I'll let you know what they find.

#1278225

Ok.......... waiting.........

#1279971

Hello Nigel...

I am waiting for solution........

#1280669

Hi there,

Nigel will be away on vacations, until next week and therefore I'll be following up on this ticket.

He has already shared this report to the concerned team and I'll keep you updated with the progress through this ticket.

Thank you for your patience.

regards,
Waqar

#1282871

ok.......

#1282893

Update: This has been included in our known issues section at:
https://toolset.com/errata/views-interferes-with-custom-relevanssi-results-ordering/

I'll let you know once this gets fixed, through this ticket.

regards,
Waqar

#1300239

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

We published an update to Views yesterday which should fix this issue, if you could please update and verify.

(Note, you need to apply all available updates to Toolset plugins, not just Views.)

#1300251

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry, I spoke too soon, I just noticed the internal ticket says the fix is included in Views 2.9.1, it didn't make it into yesterday's release, but will likely be published next week.

#1306419

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

Views 2.9.1 has now been released and includes the fix for this issue, if you could please update and verify.

Thanks.