Posted by Rob Ganly on November 27, 2012 at 4:57pm
Hi All,
I have built a custom module that is undertaking a variety of tasks. I am now needing to conduct a search from within the module.
I have implemented and am getting the correct results that I expect from keywords using the search_data function.
However I want this data to be returned as objects/arrays/data-structures of some type, not html, as the above is doing, as I need to be able to return this data in various bespoke formats myself.
I have done a number of searches but can't find anything suitable. Any pointers gratefully received, it'd be great if I didn't have to create the sql and run a query myself... although I supposed this is an option...
Thanks in advance,
Rob Ganly
Comments
I have found this function:
I have found this function: http://api.drupal.org/api/drupal/modules!search!search.module/function/do_search/6
Which gives me the nids of the nodes matching my search term(s) (which is great and will allow me to load each node to get what I need), however, it only returns 10 results, as this is hard-coded in the function... In order to change this (without hacking the function itself) it seems I have to copy the entire function and replace this hard coded var with a variable, and then change this according to my needs.
The above seems a bit long-winded, although looks like the best option available at the moment. Any other ideas to solve this issue appreciated (as I understand it there is provision in Drupal 7 to overcome this, but unfortunately I only have access to Drupal 6 for what I am working on).
Best,
Rob Ganly