Search results via Ajax produces different results
-
I must be doing something wrong here but I can’t figure it out.
I’m trying to grab Relevanassi search results via Ajax. I’m doing this the standard WordPress way via an ajax call to admin-ajax.php with a dedicated function registered in functions.php.
I get different results on the search page vs my ajax call.
Here is my relevanssi query in my ajax function for the search query “wow” (hardcoded for now):
global $query; $search_results = $query; $search_results->query_vars['s'] = 'wow'; $search_results->query_vars['posts_per_page'] = 10; $search_results->query_vars['offset'] = 0; relevanssi_do_query($search_results);
“found_posts” on my search page is equal to 29 for the same search term, whereas the relevanssi call in my ajax query returns 39 found_posts.
They are both using the same relevanssi query:
string(391) "SELECT relevanssi.*, relevanssi.title * 5 + relevanssi.content + relevanssi.comment * 0.5 + relevanssi.tag * 3 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 1 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf FROM wp_relevanssi AS relevanssi WHERE relevanssi.term = 'wow' ORDER BY tf DESC LIMIT 500"
Any idea why this might be happening? I’m stumped.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Search results via Ajax produces different results’ is closed to new replies.