• Resolved dlouwe

    (@dlouwe)


    I have a form that under certain conditions will apply relevanssi_do_query() to a WP_Query object for its advanced searching capabilities (primarily custom fields). This was working up to at least 3.3.7.1 of the plugin, but updating to 3.4.1 now causes it to return an empty result – even if the original query search would have found a match (e.g. in the post title).

    Reverting the plugin back to 3.3.7.1 does allow the form to again work as expected. I haven’t yet tried any of the versions in between.

    Can you think of any changes that could have affected how my query is being returned, or is there any other information I can provide to help diagnose the issue?

    https://wordpress.org/plugins/relevanssi/

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

    (@msaari)

    The most signifcant change between 3.3.7.1 and 3.4.1 is how meta_queries are handled. Is is possible that there’s a meta_query involved somehow in the WP_Query object? Trying to sort by meta key is one thing that may cause problems – could it be that?

    Thread Starter dlouwe

    (@dlouwe)

    Yes, it does appear that sorting by a meta key is causing the issue; removing the orderby parameter fixes it. Do you know of any way to work around this issue that still lets me sort the results by a meta key? Here’s a sample of my arguments array for reference:

    array(10) {
      ["post_type"]=>
      string(13) "presentations"
      ["order"]=>
      string(4) "DESC"
      ["orderby"]=>
      string(14) "meta_value_num"
      ["posts_per_page"]=>
      int(10)
      ["paged"]=>
      int(1)
      ["tax_query"]=>
      array(0) {
      }
      ["s"]=>
      string(4) "robo"
      ["wpcf-author"]=>
      bool(false)
      ["meta_key"]=>
      string(22) "wpcf-presentation-date"
      ["meta_query"]=>
      array(0) {
      }
    }

    Thanks a lot for your help!

    Plugin Author Mikko Saari

    (@msaari)

    Yes, you need a workaround, because that meta_key search just doesn’t work with Relevanssi. In a future version, maybe, but meanwhile the only way to do a meta field orderby is to use a relevanssi_hits_filter filter to sort the results.

    Thread Starter dlouwe

    (@dlouwe)

    Perfect, relevanssi_hits_filter was exactly what I was looking for; I’m all sorted.

    Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Recent update now returns empty results’ is closed to new replies.