Hi,

I'm having a problem when exposing 'Search Terms' as a Filter. When i search on a particular word, i'm getting two errors, one of them:

user warning: Can't group on 'score' query: SELECT COUNT(*) FROM (SELECT DISTINCT(users.uid) AS uid, SUM(search_index.score * search_total.count) AS score, users.picture AS users_picture, users.name AS users_name, users.created AS users_created, users.access AS users_access, profile_values_profile_werksituatie.value AS profile_values_profile_werksituatie_value, profile_values_profile_postcode.value AS profile_values_profile_postcode_value FROM users users LEFT JOIN search_index search_index ON users.uid = search_index.sid LEFT JOIN search_total search_total ON search_index.word = search_total.word LEFT JOIN profile_values profile_values_profile_werksituatie ON users.uid = profile_values_profile_werksituatie.uid AND profile_values_profile_werksituatie.fid = '20' LEFT JOIN profile_values profile_values_profile_postcode ON users.uid = profile_values_profile_postcode.uid AND profile_values_profile_postcode.fid = '15' WHERE (users.uid not in ('0')) AND (search_index.word = '9880') AND (search_index.type = 'users') GROUP BY search_index.sid, users_access, users_created, users_name, uid, score, users_picture, profile_values_profile_werksituatie_value, profile_values_profile_postcode_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.

When i leave the word 'score' out of the GROUP BY clause, i can run my query succesfull! I allready checked in "views_handler_filter_search.inc" to delete the 'score' in my GROUP BY clause:

$this->query->add_field('', "SUM(search_index.score * search_total.count)", 'score', array('aggregate' => TRUE)); -> this clause

But that isn't so easy. Can someone help me? In the attachment, a screenshot of my view.

Thanks in advance!

Gunther

CommentFileSizeAuthor
search_terms.jpg45.18 KBguntherdevisch

Comments

merlinofchaos’s picture

Status: Active » Fixed

This should already be fixed in -dev.

guntherdevisch’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Status: Fixed » Active

Hi,

Thanks for the reply! I've updated my views-version to the new development version, but when i enter a particular word in my search box, i'm getting two errors again (other errors):

* 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.

Can you or somebody else help me with these errors?

Thanks in advance!

Gunther

guntherdevisch’s picture

Anyone please?

Thanks!

Gunther

guntherdevisch’s picture

Version: 6.x-2.x-dev » 6.x-2.4
Priority: Normal » Critical

I've just installed the new 6.x-2.4 version of views, but i'm still having the above 2 errors. It's strange, but can someone help me?

Thanks for you time!

Gunther

dww’s picture

Status: Active » Closed (duplicate)