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: | critical |
| Assigned: | Unassigned |
| Status: | won't fix |
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...
#6
#7
Patch doesn't apply anymore at this point, I'll investigate later to try and fix it.
[swentel@swenteltop drupal]$ patch -p0 < do_search.patchpatching file modules/node/node.module
Hunk #1 succeeded at 1249 (offset 56 lines).
Hunk #2 FAILED at 1342.
1 out of 2 hunks FAILED -- saving rejects to file modules/node/node.module.rej
patching file modules/search/search.module
Hunk #1 succeeded at 859 (offset 2 lines).
Hunk #2 FAILED at 908.
1 out of 3 hunks FAILED -- saving rejects to file modules/search/search.module.rej
patching file modules/search/search.test
#8
Playing patch bingo... saw that this needed to be updated for HEAD. I rerolled the patch for HEAD and verified that all tests pass without failure or exception.
I cannot vouch for the functional merit of this patch. I am not that familliar with the search.module. I notice, tough, that a few respected drupalers seem to think its quite important. So here it is, re-rolled for HEAD (D7).
Thanks
#9
patch is ready for review.
#10
The last submitted patch failed testing.
#11
DBTNG fixed this. yay.