• Resolved davethedon

    (@davethedon)


    Hi,

    In the search_query_simple() function there is a call to relevanssi_do_query(), which only returns post objects. Perhaps it once returned IDs on request but certainly not now.

    @return array The found posts, an array of post objects.

    relevanssi_do_query()

    This means there’s a query error on search pages, due to not having any post IDs in the IN MySQL function.

    In my copy of the plugin, I have rectified it with an elseif as follows:

    foreach($posts as $post) {
    	if( is_numeric($post) ) {
    		$correct_posts[] = $post;
    	} elseif( $post instanceof WP_POST ) {
    		$correct_posts[] = $post->ID;
    	}
    }

    Could you implement this or a similar fix for the next version, please?

    Best,

    Dave

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author RazyRx

    (@razyrx)

    Hello,

    Plugin add parameter ‘fields’ => ‘ids’ to query, that means it must return only post ids instead posts.
    Also this parameter seems must work https://www.relevanssi.com/user-manual/functions/relevanssi_do_query/
    Query parameters has this option.
    Do you have any error with this on your site?

    Regards,
    Oleg

    Thread Starter davethedon

    (@davethedon)

    Hi Oleg,

    I saw that parameter was added to the query but the relevanssi_do_query() function seems to do its own processing to return post objects instead regardless.

    The documentation also mentions that there is no return type, but that isn’t true, and your plugin is assigning the return value to $posts, which I’ve debugged and they contain post objects – not IDs.

    Best,
    Dave

    Plugin Author RazyRx

    (@razyrx)

    Hello,

    And also in documentation of Relevanssi this parameter in list and must be supported.

    What exactly page has this issue on your site to check it on our test environment?

    Regards,
    Oleg

    Thread Starter davethedon

    (@davethedon)

    Hi Oleg,

    It’s the search page. Do a product search and the filters will not show up when using Relevanssi.

    Thread Starter davethedon

    (@davethedon)

    Hi,
    Any news on this? Just to clarify, on the search page the product filters don’t show up on the product search page specifically because of a 500 error in the ajax request caused by the Relevanssi integration not getting the post IDs, but rather the post objects from the aforementioned function. It does not affect the regular catalog (store/category) pages.

    Plugin Author RazyRx

    (@razyrx)

    Hello,

    Checked how it work on our side and it seems work correct and return product IDs.
    Do you use Relevanssi or Relevanssi Premium?
    Also maybe some other plugin or theme modify how it work, that cause this issue.

    Regards,
    Oleg

    Thread Starter davethedon

    (@davethedon)

    Hi Oleg,
    My apologies – you’re absolutely right. I dug into the issue and found that a custom plugin was hooked into the “relevanssi_hits_filter” filter and did flip the IDs into objects indiscriminately, and for no good reason either. Easy fix.

    Thanks for your help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Bug in Relevanssi Integration’ is closed to new replies.