Stop avoiding db_rewrite_sql() in node_search()
moshe weitzman - March 18, 2006 - 03:30
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | search.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs work) |
Description
node_search() passes an empty query to db_rewrite_sql() instead of the actaul query to perform. this is not the spirit of this hook. move db_rewrite_sql() call to later during the query build process.

#1
Does this still apply?
I don't find a call to db_rewrite_sql() in node_search(). I do find a _db_rewrite_sql() in node_search('search'). Is that what you mean?
Please elaborate.
#2
yes, i refer to _db_rewrite_sql()
changed title to be more clear.
#3
#4
Yes. This needs to be done as part of a refactoring of do_search since the query fragments present in node_search aren't really sufficient to do the db_rewrite_sql() in their current form. I suppose it belongs in do_search and any specific information that db_rewrite_sql needs has to be passed into do_search as well. Or we make a nice query builder that can replace do_search.
#5
LIVE FROM THE MINNESOTA SEARCH SPRINT! Here's a patch that refactors do_search() slightly... It has some pros and cons:
Pros:
Cons:
However, this patch might become a (small) first step towards a larger issue encompassing search query parsing and building...