Hello guys
Dunno if this is search or node-related, so posting in node system.
The problem is broken pgsql compatibility.
warning: pg_query(): Query failed: ERROR: operator does not exist: integer || integer LINE 1: ...d), MAX(n.changed), MAX(c.last_comment_timestamp) || 1) - 12... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. in .../html/includes/database.pgsql.inc on line 139.
user warning: query: SELECT COUNT(*) FROM (SELECT i.type, i.sid, 5 * (3.1220535619509 * SUM(i.score * t.count)) + 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp) || 1) - 1285569804) * 6.43e-8) AS score FROM drupalsearch_index i INNER JOIN drupalsearch_total t ON i.word = t.word INNER JOIN drupalnode n ON n.nid = i.sid LEFT JOIN drupalnode_comment_statistics c ON c.nid = i.sid WHERE n.status = 1 AND (i.word = 'htpasswd') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1) n1 in .../html/modules/search/search.module on line 958.
warning: pg_query(): Query failed: ERROR: operator does not exist: integer || integer LINE 1: ...d), MAX(n.changed), MAX(c.last_comment_timestamp) || 1) - 12... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. in .../html/includes/database.pgsql.inc on line 139.
user warning: query: SELECT i.type, i.sid, 5 * (3.1220535619509 * SUM(i.score * t.count)) + 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp) || 1) - 1285569804) * 6.43e-8) AS score FROM drupalsearch_index i INNER JOIN drupalsearch_total t ON i.word = t.word INNER JOIN drupalnode n ON n.nid = i.sid LEFT JOIN drupalnode_comment_statistics c ON c.nid = i.sid WHERE n.status = 1 AND (i.word = 'htpasswd') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 ORDER BY score DESC LIMIT 10 OFFSET 0 in .../html/modules/search/search.module on line 958.
As I see, there is no such operator 1 || 1 in postgresql, it is mysql-only
see,
select 1 || 1
ERROR: operator does not exist: integer || integer
LINE 18: select 1 || 1
Here is how I fixed this bug for my production server (line 1238 in modules/node/node.module):
//$ranking[] = '%d * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp) || 1) - %d) * 6.43e-8)'; // old code
$ranking[] = '%d * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), CASE WHEN MAX(c.last_comment_timestamp) IS NOT NULL AND MAX(c.last_comment_timestamp) <> 0 THEN MAX(c.last_comment_timestamp) ELSE 1 END) - %d) * 6.43e-8)'; // fix
Dunno if this is helpful, but here are my modules
Drupal core 6.19 6.19 Up to date
BUEditor 6.x-1.4 6.x-1.4 Up to date
CacheExclude 6.x-2.1 6.x-2.1 Up to date
Content Construction Kit (CCK) 6.x-2.8 6.x-2.8 Up to date
CSS 6.x-1.0 6.x-1.0 Up to date
IMCE 6.x-1.4 6.x-1.4 Up to date
Menu attributes 6.x-1.4 6.x-1.4 Up to date
Nice Menus 6.x-1.3 6.x-1.3 Up to date
Nodewords 6.x-1.11 6.x-1.11 Up to date
Meta Tags by Path 6.x-1.0 6.x-1.0 Up to date
Pathauto 6.x-1.4 6.x-1.5 Update available
SEO Friend 6.x-1.0-beta7 6.x-1.0-beta7 Up to date
Token 6.x-1.14 6.x-1.15 Update available
Views 6.x-2.11 6.x-2.11 Up to date
PostgreSQL 8.3.7 on amd64-portbld-freebsd7.2, compiled by GCC cc (GCC) 4.2.1 20070719 [FreeBSD]
Comments
Comment #1
faito commentedComment #2
faito commentedComment #3
damien tournoud commentedThanks for your report, but this is a duplicate of #488166: Search relevance calculation fails if last_comment_timestamp is NULL.
Comment #4
liam morland