Hi, I'm using faceted search on drupal 6.8, views 2.2

It runs very well, but I now get always this 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 '***CURRENT_USER***) LEFT JOIN workflow_node workflow_node ON node.nid = workflo' at line 3 query: CREATE TEMPORARY TABLE temp_faceted_search_results_1 (nid int unsigned NOT NULL, PRIMARY KEY (nid)) Engine=HEAP SELECT DISTINCT(n.nid) AS nid, 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp)) - 1238242948) * 6.43e-8) + 5 * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * 0.5)) AS score FROM node AS n LEFT JOIN node_comment_statistics AS c ON n.nid = c.nid WHERE ((n.status = 1) AND (n.type IN ('articulo','audio','foto','video'))) AND n.nid IN (SELECT DISTINCT(node.nid) AS nid FROM node node LEFT JOIN flag_content flag_content_node ON node.nid = flag_content_node.content_id AND (flag_content_node.fid = 4 AND flag_content_node.uid = ***CURRENT_USER***) LEFT JOIN workflow_node workflow_node ON node.nid = workflow_node.nid LEFT JOIN content_field_contenido_tematica node_data_field_contenido_tematica ON node.vid = node_data_field_contenido_tematica.vid INNER JOIN users users ON node.uid = users.uid LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid LEFT JOIN content_field_contenido_precio node_data_field_contenido_precio ON node.vid = node_data_field_contenido_precio.vid WHERE (node.status <> 0 OR node.uid = ***CURRENT_USER*** or ***ADMINISTER_NODES*** = 1) AND (node.type in ('articulo', 'audio', 'foto', 'video')) AND (node.created > 1238253102-2592000) AND (workflow_node.sid in (3, 26)) AND (flag_content_node.uid IS NULL) ) GROUP BY n.nid ASC ORDER BY score DESC in

I don't know what is happened. I edited some views parameters, deleted nodes... And now it gives this error and faceted blocks disappeared.

Any ideas?
Thanks

Comments

msoler75’s picture

I've solved using (very ugly)

	global $user;
	$q = str_replace('***CURRENT_USER***', intval($user->uid), $query->query());
	$q = str_replace('***ADMINISTER_NODES***', intval(user_access('administer nodes')), $q);
	db_query('CREATE TEMPORARY TABLE '. $this->_results_table .' (nid int unsigned NOT NULL, PRIMARY KEY (nid)) Engine=HEAP '. $q, $query->args(), $this->_results_table);

in line 1179 of faceted_search.inc.

David Lesieur’s picture

Status: Active » Closed (duplicate)