• Resolved wohlstadterewg

    (@wohlstadterewg)


    Does Relevanssi support sorting on multiple columns? My understanding is that the WP_Query supports passing multiple columns in the format of:

    ‘orderby’ => array(‘columna’ => ‘ASC’, ‘columnb’ => ‘DESC’)

    However, Relevanssi seems to be expecting a string for the ‘orderby’ option.

    Thanks,
    Michael

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Correct – Relevanssi pretty much fails if you try to pass an array in orderby. I just recently learnt that it’s legal to pass an array there…

    I’m going to fix that in the next version so that Relevanssi supports the array format, but I’m not sure whether Relevanssi will support multiple column sorting or not. When searching, it’s not that useful to sort by multiple columns.

    If you need multiple column sorting, I’d be interested in hearing what kind of use case you have in mind.

    Plugin Author Mikko Saari

    (@msaari)

    Actually, implementing the multi-level sorting wasn’t particularly difficult. From the next version on, Relevanssi will support array orderby, with multiple levels of sorting. Relevanssi will also cover a much larger number of possible sort options in WordPress – not everything, but almost.

    If you want to test this, drop me an email to [email protected], and I’ll give you a preview.

    Thread Starter wohlstadterewg

    (@wohlstadterewg)

    Thanks for the fast response!

    My use case is that we have a library of files (documents, spreadsheets, maps, etc.) that we are using Relevanssi to search. For the most part, sorting by relevance is all that is required. However, in some cases two or more documents have the same relevance score. In those cases we would like the documents sorted by the secondary key, title.

    I am interested in the preview and will email you.

    Thanks again,
    Michael

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Multiple Column Ordering’ is closed to new replies.