postgresql8.3 insert into txt (object_id,fti) values (:object_id, setweight(to_tsvector(coalesce(:title,'')),'A') ||setweight(to_tsvector(coalesce(:keywords,'')),'B') ||to_tsvector(coalesce(:txt,''))) postgresql8.4 where fti @@ to_tsquery(:query) postgresql8.3 select txt.object_id from [join $from_clauses ","] $base_query [expr {[llength $where_clauses] > 0 ? " and " : ""}] [join $where_clauses " and "] order by ts_rank(fti,to_tsquery(:query)) desc $limit_clause $offset_clause postgresql8.4 select distinct(orig_object_id) from acs_permission.permission_p_recursive_array(array( select txt.object_id from [join $from_clauses ","] $base_query [expr {[llength $where_clauses] > 0 ? " and [join $where_clauses { and }]" : ""}] order by ts_rank(fti,to_tsquery(:query)) desc ), :user_id, 'read') $limit_clause $offset_clause postgresql8.3 select count(*) from [join $from_clauses ","] $base_query [expr {[llength $where_clauses] > 0 ? " and [join $where_clauses { and }]" : ""}] postgresql8.4 select count(distinct(orig_object_id)) from acs_permission__permission_p_recursive_array(array( select txt.object_id from [join $from_clauses ","] $base_query [expr {[llength $where_clauses] > 0 ? " and " : ""}] [join $where_clauses " and "] ), :user_id, 'read') postgresql8.3 select ts_headline(:txt,to_tsquery(:query)) postgresql8.3 update txt set fti = setweight(to_tsvector(coalesce(:title,'')),'A') ||setweight(to_tsvector(coalesce(:keywords,'')),'B') ||to_tsvector(coalesce(:txt,'')) where object_id=:object_id postgresql8.2 select count(*) from [join $from_clauses ","] $base_query [expr {[llength $where_clauses] > 0 ? " and " : ""}] [join $where_clauses " and "]