Hey Guys,

The installation of apachesolr module and Apache Solr itself went amazingly smooth. However, I'm only returned 10 search results without the paging bar at the bottom. Any ideas why this may be or where in the code to look for the problem?

Thanks

Comments

paradigmshifter’s picture

I see that the pager_query is being called on line 147 of apachesolr_search.module :

pager_query("SELECT %d", $params['rows'], 0, NULL, $total);

And with my Devel module and IDE I see that the query being called is:

SELECT 75 LIMIT 0, 10

(75 being the $total) Is this how the query is supposed to look? No pager shows up even though a core search on the "Content" tab of search does show a pager... Very bizarre.

paradigmshifter’s picture

Category: support » bug
Priority: Normal » Critical

Am I the only one who is experiencing this problem in Drupal 5?

When I change the pager_query to something that makes more sense (for testing only):
pager_query("SELECT * FROM users", $params['rows'], 0, NULL);

The pager shows up... So the problem must be that the pager_query doesn't know how to interpret
pager_query("SELECT %d", $params['rows'], 0, NULL, $total);

Is there another way to give the pager_query the total?

paradigmshifter’s picture

This may not be the best solution but I decided to take the important parts of the pager_query function and use them within apachesolr_search_search()

To the top of the function I added:
global $pager_page_array, $pager_total, $pager_total_items;

I then replaced:
pager_query("SELECT %d", $params['rows'], 0, NULL, $total);

With:

$element = 0;
$pager_page_array = explode(',', $page);
$pager_total_items[$element] = $total;
$pager_total[$element] = ceil($pager_total_items[$element] / $params['rows']);
$pager_page_array[$element] = max(0, min((int)$pager_page_array[$element], ((int)$pager_total[$element]) - 1));
damien_vancouver’s picture

Assigned: Unassigned » damien_vancouver

@paradigmshifter,

Did you solve this problem?

I cannot replicate on my production sites or on a test site with just the basics installed and 12 test posts. (when I search a common term on all I see the correct 2 page pager, even using the default Bluemarine theme.

Please let me know if you're still having trouble? Thanks.

jpmckinney’s picture

Status: Active » Closed (duplicate)