Index: openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 30 Dec 2004 14:26:45 -0000 1.9 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 30 Dec 2004 15:31:00 -0000 1.10 @@ -138,9 +138,13 @@ from acs_object_party_privilege_map m where m.object_id = txt.object_id and m.party_id = :user_id - and m.privilege = 'read')order by rank(fti,to_tsquery('default',:query)) ${limit_clause} ${offset_clause}" + and m.privilege = 'read') order by rank(fti,to_tsquery('default',:query)) ${limit_clause} ${offset_clause}" set results_ids [db_list search $query_text] - set count [db_string count "select count(*) from txt where fti @@ to_tsquery('default',:query)"] + set count [db_string count "select count(*) from txt where fti @@ to_tsquery('default',:query) and exists + (select 1 from acs_object_party_privilege_map m + where m.object_id = txt.object_id + and m.party_id = :user_id + and m.privilege = 'read')"] set stop_words [list] # lovely the search package requires count to be returned but the # service contract definition doesn't specify it!