Allow db_rewrite_sql for search module...

mediumgrade - January 7, 2008 - 09:10

I am not a Drupal developer, but I do have a suggestion.

The line of code in question is in the search.module file on line 871 (in search module version 1.209.2.5)

$result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);

There was in instance in which I wanted to limit the number of search results returned to only 5. The only way I found that I could do this was in modifying this query. Can we wrap this query in a db_rewrite_sql function so as to make it accessible to Drupal users without having to change the actual module?

There's a feature request

gpk - January 7, 2008 - 09:59

There's a feature request open for this at http://drupal.org/node/33809. It's been active since 2005, but unfortunately this isn't going to make it into Drupal before version 7.

gpk
----
www.alexoria.co.uk

And why is that? Is this

mediumgrade - January 8, 2008 - 03:43

And why is that? Is this task more difficult than it looks? Is there anything I can do to help this along?

My apologies, if I would really like to help implement this without having to wait until version 7.

>And why is that? Is this

gpk - January 8, 2008 - 13:09

>And why is that? Is this task more difficult than it looks?

It's not particularly difficult but there are quite a lot of code changes needed to come up with a complete solution for the whole of Drupal (rather than just a little tweak to meet your own requirements). It just didn't receive enough developer attention in time. RC1 has been out since before Christmas so it's rather late to be adding functionality to D6.

>Is there anything I can do to help this along? ... I would really like to help implement this without having to wait until version 7.

If the patch on that issue gets thoroughly tested (as in, *now*), and if the implementation of the functionality in the patch is elegant, well-coded, efficient etc. there's a small chance that Gábor Hojtsy, the main D6 branch maintainer, might be inclined to include it in D6. But that's a big "if"; in partcular, I wouldn't be surprised if the core developers will want some changes to the way it's implemented, and their focus now is on getting D6 out of the door.

If you want the functionality in D6 just for yourself then you would have to apply the patch manually to your downloaded copy/ies of D6, and possibly reapply after each D6.x upgrade.

If you want the functionality in D5 then since it's quite a big patch it's unlikely to work without modification... Your best bet would be to make a small patch of your own (or just hack the search.module as you see fit!) But be aware of the need potentially to re-hack/re-patch each time you apply a security upgrade/update etc.)

gpk
----
www.alexoria.co.uk

 
 

Drupal is a registered trademark of Dries Buytaert.