For returning distributed search results, need to know the total count of search results found to build a pager.

CommentFileSizeAuthor
apachesolr_return_total.patch1.78 KBaufumy

Comments

pwolanin’s picture

Status: Needs review » Postponed (maintainer needs more info)

We already build a pager for search, and we already get the total in the response, so I'm rather unclear why this is needed

aufumy’s picture

If other types of interfaces want to query apache solr search to return results, whether exhibit or distributed search via xmlrpc services, the results returned would be by default the first 10 formatted results, with no indication to the caller how many there are in total.

Therefore on the callers side, it cannot show how many pages or results in total.

Scott Reynolds’s picture

$response = apachesolr_static_response_cache();
$total = $response->response->numFound;

That prevents you from executing two queries....

aufumy’s picture

I considered this earlier, and maybe I haven't experimented enough, but I do not believe it would work with separate remote xmlrpc calls.

Since they are completely different calls, I do not believe that the other call would have to the cached $response values in static $_response.

However, the way that I tried to test the theory earlier was by running normal apache solr search, and then having a different page run the code similar to the snippet above, $response was not populated.

pwolanin’s picture

Obviously it won't work in different page loads, but why not just send back the 1st result set + the count on one xml-rpc call?

aufumy’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Actually that makes a lot of sense, thank you for the responses, my brain is going in circles.

Just thinking out loud, the returned array returned could have

$results['total'] = 123;
$results[0]['id'] = 'b9fcd1c7caf9/node/5174';
$results[0]['name'] = 'test.user';
$results[0]['nid'] = '5174';
$results[0]['title'] = 'Test title...';
...