I have a custom search page (which displays dropdowns for specific categories and content types) which is working fine using node_search:
$results = node_search ('search',$searchterms);
Unfortunately the sorting is quite bizarre and I can't find a way to sort using node_search. I've been trying to research do_search, which has a ton of options it seems, but can't seem to get it to work the same way. Is anyone familiar with do_search and willing to point me in the right direction?
do_search($keywords, $type, $join1 = '', $where1 = '1', $arguments1 = array(), $select2 = 'i.relevance AS score', $join2 = '', $arguments2 = array(), $sort_parameters = 'ORDER BY score DESC')
With node_search, I can add things like "category:1" to the $searchterms and it will filter based on category. I'm not sure if this is possible with the $keywords variable in do_search, or if $type is the content type? Any advice for me? (The API hasn't clarified it for me)
Thanks!
Comments
do_search and pager
I think I've got it functioning using do_search now with the correct sorting that I want... and have noticed that only 10 results show up. This seems to be hard-coded in somewhere. :(
Can anyone advise me on how to add a pager nav bar at the bottom so people can click through to the next 10 results?
line 871
File: search.module
Line: 871
Code: $result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);
you see 10 is hard coded.
Vinay Yadav
PHP / Drupal Developer
http://www.vinayras.com
www.eDrupal.com - Indian Drupal Community
thanks
Thanks -- I have moved from using do_search to using pager_query directly so I can change that variable.
have you tried appending the
have you tried appending the output from theme('pager'); to the end of your search results? The following worked for me when testing.
thanks
by the way -- thanks for this jbomb. sorry for the late response but this was a very helpful post and gave me enough to explore a little further -- pager_query ended up being useful too since i didn't want them to have to enter search terms (so they can filter based on specific terms only and i can format the results, including the number of results per page).