Support » Plugins » [Plugin: JSON API & Relevanssi] Relevanssi not able to return json results?

  • Resolved strop

    (@strop)


    Good day everyone.

    I’m currently working on a rather large site for a client and the need for searching taxonomies and better search results has become apparent.

    I’m currently using the JSON API for an ajax search and that is working great. I enabled the Relevanssi plugin and the search results are, once again, working great. However, as soon as I try to get the results in JSON format with &json=1, it only returns the default search results.

    My guess is that the hooks that relevanssi use to change the default search behaviour isn’t that compatible with the hooks JSON api uses.

    Any ideas and/or suggestions on how to resolve this?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I don’t know how JSON API works. I’ve never heard of the plugin, so it’s no surprise Relevanssi doesn’t quite cooperate.

    Looking at it, I suppose the API gets the search results in a way that doesn’t trigger Relevanssi. Relevanssi uses the_posts hook and checks for is_search(). If either of these doesn’t happen, Relevanssi won’t activate.

    Ok, looks like I figured it out… in /singletons/introspector.php, the set_posts_query() function fetches the search results (and other post arrays) with query_posts(). That would need to be changed… See this pastebin.

    That worked out perfectly! Thank you so so much for both the quick response and the great solution!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: JSON API & Relevanssi] Relevanssi not able to return json results?’ is closed to new replies.