parisholley / wordpress-fantastic-elasticsearch

Improve wordpress search performance/accuracy and enable faceted search by leveraging an ElasticSearch server.
MIT License
162 stars 64 forks source link

Pagination not working #106

Closed todeveni closed 9 years ago

todeveni commented 9 years ago

Don't have the time to debug right now, since I don't know how to debug Elasticsearch and/or this plugin, but pagination is not working with plugin enabled. Pagination works when plugin is disabled.

http://example.com/?s=test&paged=2 ends up in 404, even though there's 42 pages of results.

My search.php is basically like this:

<?php
get_header();

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('s='. $s .'&paged='. $paged .'&posts_per_page=50');

if (have_posts()) {
    while (have_posts()) {
        the_post();

        get_template_part('loop', 'search');
    }
}

get_footer();
?>
parisholley commented 9 years ago

You need to implement your changes to query_posts as a filter, not rewriting it in your search.php (elasticsearch and main query is done prior to this template being loaded).