Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.4
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
27 Mar 2009 at 15:21 UTC
Updated:
5 May 2009 at 19:44 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedLet me guess. When you use them pink elephants come out of your screen and trample your keyboard turning into useless goo? Oh wait. This is an issue queue. I shouldn't have to guess what you mean by 'break'.
Please use proper issue queue etiquette, lest I send pink elephants to your house to turn your keyboard into useless goo to save the rest of us.
Comment #2
derjochenmeyer commentedsorry ;) it was indeed a little too brief... I just reported it (very) shortly (since its a dev version) and returned to the stable version. It seems its not easily reproduceable.
By "break" i mean the search returned no results after upgrading to latest dev.
- I tried rebuilding the search index without any result
- cleared all caches AND views cache
I have an exposed filterset:
- "Search: Search Terms" (On empty input: Show All) AND "Node: Type"
- Sorting 1st "Node: Post date" 2nd "Search: Scrore"
- Drupal 6.10
- Views 6.x-2.3
- AJAX turnded OFF
btw: thanks for this great module... !
Comment #3
derjochenmeyer commentedI ran into the same issue on another site now. Exposed "Search" filters return no results. No log errors. Reverting to 6.x-2.3 solves the problem.
Comment #4
merlinofchaos commentedCan you do me a favor and paste the query that the view produces?
Comment #5
dodorama commentedI'm having the same issue.
Drupal 6.10
Views 6.x-2.4
Here's the query:
Here's the error
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS score, field_project_image_fid, field_project_image_list, field_pr' at line 2 query: SELECT node.nid AS nid, SUM(search_index.score * .count) AS score, field_project_image_fid, field_project_image_list, field_project_image_data, node.type AS node_type, node.vid AS node_vid, node.title AS node_title FROM node node LEFT JOIN search_index search_index ON node.nid = search_index.sid LEFT JOIN search_total ON search_index.word = .word WHERE (node.type in ('project')) AND (node.status <> 0) AND (search_index.word = 'teatro') AND (search_index.type = 'search_index') GROUP BY search_index.sid, node_title, nid, field_project_image_fid, field_project_image_list, field_project_image_data, node_type, node_vid HAVING COUNT(*) >= 1 ORDER BY node_title ASC in /var/www/vhosts/dodorama.com/subdomains/guerri/httpdocs/site/sites/all/modules/views/includes/view.inc on line 735.
Here's the view export:
Comment #6
guntherdevisch commentedI'm having the same problem (also in version 6.x-2.4) , my errors are:
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS score, users.picture AS users_picture, users.name AS users_name, u' at line 2 query: SELECT COUNT(*) FROM (SELECT DISTINCT(users.uid) AS uid, SUM(search_index.score * .count) AS score, users.picture AS users_picture, users.name AS users_name, users.created AS users_created, users.access AS users_access, value FROM users users LEFT JOIN search_index search_index ON users.uid = search_index.sid LEFT JOIN search_total ON search_index.word = .word WHERE (users.uid not in ('0')) AND (search_index.word = 'test') AND (search_index.type = 'search_index') GROUP BY search_index.sid, users_access, users_created, users_name, uid, users_picture, value HAVING COUNT(*) >= 1 ORDER BY users_access DESC, users_created DESC, users_name ASC ) count_alias in /home2/ikverdie/public_html/modules/views/includes/view.inc on line 705.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS score, users.picture AS users_picture, users.name AS users_name, u' at line 2 query: SELECT DISTINCT(users.uid) AS uid, SUM(search_index.score * .count) AS score, users.picture AS users_picture, users.name AS users_name, users.created AS users_created, users.access AS users_access, value FROM users users LEFT JOIN search_index search_index ON users.uid = search_index.sid LEFT JOIN search_total ON search_index.word = .word WHERE (users.uid not in ('0')) AND (search_index.word = 'test') AND (search_index.type = 'search_index') GROUP BY search_index.sid, users_access, users_created, users_name, uid, users_picture, value HAVING COUNT(*) >= 1 ORDER BY users_access DESC, users_created DESC, users_name ASC LIMIT 0, 25 in /home2/ikverdie/public_html/modules/views/includes/view.inc on line 731.
Thanks!
Greetz Gunther
Comment #7
derjochenmeyer commentedviews 6.x-2.4
Comment #8
dleong commentedI'm having a similar issue: #428276: Search using Views filters and error in SQL syntax - please help.
Thanks in advance for help.
Comment #9
wlp1979 commentedThe error is caused by the missing table alias for the search_total table. I found that changing line 90 in views_handler_filter_search.inc from:
to
fixed the problem for me. However, I'm not convinced this is the best course of action. It seems that the query->add_relationship method should detect a NULL alias and handle that properly.
Comment #10
guntherdevisch commentedHi,
I changed line 90 in views_handler_filter_search.inc, and i'm having no errors anymore! But when i search something, it doesn't give me results:( Does anyone have the same problem?
Thanks,
Gunther
Comment #11
dwwConfirmed locally. This is going to break the drupal.org issue queues if I were to upgrade d.o to views 6.x-2.4, so I'm debugging it now. Stay tuned for a patch.
Comment #12
dwwDiscussed this at length with Earl. There's no way to automatically handle a NULL $alias for add_relationship() itself. For example, if you default the alias to the $base table parameter, you're screwed because the resulting query will be trying to reuse the existing relationship instead of using a new alias. In fact, the way add_relationship() is invoked by the search filter (the root of this bug) would break if we used $base if $alias is NULL inside add_relationship() itself.
So, the problem is that $alias can't be NULL to add_relationship(). I grepped the views code, and found the following:
This is inside an edge case in add_table(). Earl says to punt on this and he'll revisit when he can swap back in the inner workings of add_table(). ;)
Supplies a real $alias, no problem here.
Commented out, not a problem.
Commented out, not a problem.
The bug here. Fixed with the attached patch.
Supplies a real $alias, no problem here.
So, the only real problem is the bug reported here, and the edge case in add_table(). Two patches attached -- one that fixes the search bug, and another that removes the commented out bogus versions.
Comment #13
dleong commentedAlthough most of this is over my head, I thank you for the prompt responses, dww.
I'll read up on applying patches (oddly enough, I haven't patched anything since I started using Drupal) and try it out.
Comment #14
guntherdevisch commentedHi dww,
Thanks for your patch! I patched it, but when i'm trying to search on a particular word, he won't give me results. I'm eventhough sure that the particular word must give me results. In my attachment you can find a screenshot of my view, i was wondering if verything was correct.
Thanks for your time!
Gunther
Comment #15
dwwIf you tested it and say it doesn't work right, you shouldn't set the status to RTBC. However, I just tested again locally and my patched copy is definitely working. Even still, moving this back to needs review, pending testing from other people experiencing this bug.
Since I only really read/speak english, that screenshot doesn't make much sense to me. Besides, a screenshot of the view overview itself is pretty unhelpful for debugging -- posting an exported copy of your view would be a lot more useful.
That said, it sounds like you might have a problem where your search index is stale instead of a problem with this patch (which would be a support request, not something to discuss in this issue).
Comment #16
guntherdevisch commentedHi,
Sorry for the screenshot, here's a exported version of another view, where it doesn't work either. Maybe it's indeed a support problem.
Thanks for your help!
Gunther
Comment #17
dww@guntherdevisch: Can you search for the same term on your site using the site-wide search box? Only if it works using non-views search and fails using views does your question belong in this issue queue. If not, please just open a new issue -- it clearly has nothing to do with this bug or patch (or views itself). Thanks.
Comment #18
guntherdevisch commentedYes dww, the search works within the non-views search-box and fails within my views search-box.
Sorry for the ambiguity. I'm Dutch:)
Greetz,
Gunther
Comment #19
dodorama commentedI tested the patch and I can confirm it works in my installation.
Thanks
Comment #20
merlinofchaos commentedguntherdevisch: IF the search is failing to find a word but is not producing the error people were seeing, that is a different issue altogether.
Both of dww's patches are committed.
Comment #21
guntherdevisch commentedOke, that's true. It don't have the errors anymore, so dww's patches worked indeed. Thanks! The fact my search is failing is strange, but is as you say, another issue.
Greetz,
Gunther
Comment #22
dwwJust marking this so we know that we need to be sure to deploy from views 6.x-2.5 when we next rev the version of views running on d.o. Sorry for the extra noise, merlinofchaos, but we're depending on this tag to keep things sane for d.o.
Comment #24
dwwd.o is now running views 6.x-2.5, so this is now totally resolved.