Skip Navigation

[Resolved] Custom search and sorting the results

This support ticket is created 6 years, 6 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 7 replies, has 2 voices.

Last updated by Beda 6 years, 6 months ago.

Assisted by: Beda.

Author
Posts
#1072602

I am trying to: Custom search and sorting the results

Link to a page where the issue can be seen: hidden link

I expected to see: sort by AFTER a custom search

Instead, I got: nothing

THis is the problem presented in this topic and never solved: https://toolset.com/forums/topic/custom-search-and-sorting-the-results/

I raised the issue with Relevanssi author be he has no idea about how Toolset works. And since you were offering Relevanssi as custom fields search solution (aka the only reason why I bought it) I am expecting at least a contact between you Toolset guys and Relevanssi author.

Any suggestion to fix this problem would be appreciated!

Thanks

#1073402

It seems to me there ordering works fine on your site after a search?

Can you explain the exact steps I need to take on that URL to see the issue, and what you query by so to "break" the ordering?
As far I see in the linked ticket the issue there is ordering by our terms but as well by the Relevannsi weight after a specific search by a term that is queried by Relevannsi in a field of Toolset.

How would you like this to behave generally?
==> It is difficult to determine, what should have prevalence.
We are searching in a Field by Relevannsi terms, so if there the order by is set, it should be respected, right?
But if in Views as well there is order by, then it conflicts.
A solution could be a secondary orderly as we do have it in Views order settings

Means, allowing to decide what has prevalence and apply it.

However, I am A) not sure this is possible but I can verify this for you with the Developers and B) I am not sure this is the exact thing you refer to.

Can you let me know if the issue you refer to is the conflict of weight and orderby of Views, which logically should be taken over by Relevannsi here, or an issue where even if no specific weight is set in Relevannsi, the orderby in Views is broken, and not notified or hinted so in the GUI.

#1073432
screenshot-powerlanguage.school-2018.08.04-09-40-27.png
screenshot-powerlanguage.school-2018.08.04-09-39-35.png

Actually It doesn't work the sorting AFTER a custom search. See here? hidden link

I searched for the term 'colour' (and it worked) and AFTER that, I changed the sort by Title Z-A and nothing changes.

What I'm trying to say is, the sortby works alone and with other filter (currently I don't have in the test page) but in combination with a Text Search doesn't sort the results.

I hope it's clear enough, just let me know if you need the view tweaked to show something else or the view code etc.

#1073443

Yes, I understand now.
This is the exact issue as Shane outlines and we can do little about this.

As I asked, how would you like this to behave?

There is somehow no correct solution.

1. The orderby is overrun by the Relevannsi settings, correct?
2. How would you like to have Views Order applied to them?
As a secondary option? Primary, and Relvannsis as secondary?

I think, the correct solution here is this:
- the Text Search if run b releveannsi returns relevannsi results and hence, orders by it.
- that, can be produced in a notice to the end user, to let understand why in certain cases this does not work.

Actually, nice would be if Relvannsi would have front end options for this, or filters, we could use.
I am not sure this exists.

Can you let me know how you would like it to work so I can instruct the developer to research in a certain direction?

#1073445

1- yes, correct
2- Views Order as secondary I believe

I mean it seems quite natural (I know doesn't work that way but bear with me). FIRST I do a search and get RV results, THEN I order by those results. Seems fair right?
I am expecting the filters/search etc. to work in the order I use it actually OR even better, the order they are displayed, if the search is first, everything after it should be able to modify the results.

Happy to share more info. I was talking to Relevanssi developer if I can share something with him as well.

#1073467

Thanks

I will initiate what is required and update you here in regard.

It may be that we enter in contact with Relevannsi as well over internal channels.

I'll keep you posted.

#1073469

Just wanted to let you know why it's like that.

Relevanssi applies its setting only when the current query does not have a proper orderby setting, but it never happened on Views or WordPress Archives since we always set a default value.
Hence, we always sorted by our setting regardless the Relevanssi one.

We had two options here:
- offer our sorting as options, and add the Relevanssi "relevance" one as an extra option, or stick to our warnings and force the Relevanssi ordering on queries that use it.
- forcing the Relevanssi sorting when a Relevanssi search query is applied.

That last one is what happens today, and it was done because the first option would mean that we dinamicaly offer a sorting value "relevance" only when the current View or WPA does contain and get executed a search.
That means defaulting to post_date elsewhere, for example, and will open a series of side effects when changing the frontend filters or usage for the object.

Now, I am still looking into this and will see what the colleagues and DEV reply

#1078375

I have filed this as a feature request, the Developer takes a look and will decide what we can do

I also asked other colleagues working with external teams to refresh contacts with Relevanssi

We can close this here, as it if gets implemented, we will blog post about it