Closed (fixed)
Project:
Apache Solr Search
Version:
6.x-1.6
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 May 2012 at 19:51 UTC
Updated:
28 May 2012 at 10:01 UTC
Is there a way to manually call Apache solr search on a page? I know how to do that for the drupal search. This is the code I used to pull in the parameters and get the search results
$searchKey = str_replace(" ","+",$_REQUEST['searchKey']);
$result = node_search('search', $searchKey);
So the url would look something like this. www.example.com/results?searchKey=test
This works for the drupal search. However, this doesn't use the search from Apache solr. So is there anyway I can pass in parameters and pull in the search results using the apache solr module?
Comments
Comment #1
jbunyan commentedSo I used the hook_search function from the apache solr module.
$result = apachesolr_search_search('search', $searchKey);
And it pulls in the search results that I wanted. Do you think this will be a problem in a live environment.
Comment #2
pwolanin commentedIt should be ok - that's what the module itself is using, of course. However, you may need to go deeper in the API if you want more control.
Comment #3
jbunyan commentedThanks for the information. I wasn't sure if it was good Drupal practice, but it was the only thing that worked for me. So 10 search results show. If I include this in the URL ?page=2, I get the next set of results. So is it possible to pull in the correct pager for the search results. I"m not too familar with pager functions. Would pager(),theme_pager(), or pager_query() give me what I want?
Comment #4
nick_vhNormal pager would certainly give you what you would expect. Normally just use theme('pager') if you want to get a normal pager. Take a look at how the module theme's its pages and it should help you further :-)