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 -N -r1.3 -r1.4 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 6 Jun 2004 20:03:34 -0000 1.3 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 6 Jun 2004 20:29:24 -0000 1.4 @@ -127,13 +127,21 @@ set query [tsearch2::build_query -query $query] # FIXME actually write the regsub to do that, string map will # probably be too tricky to use - - set results_ids [db_list search "select object_id from txt where fti @@ ts2_to_tsquery('default',:query) order by rank(fti,ts2_to_tsquery('default',:query));"] - + set limit_clause "" + set offset_clause "" + if {[string is integer $limit]} { + set limit_clause " limit :limit " + } + if {[string is integer $offset]} { + set offset_clause " offset :offset " + } + set query_text "select object_id from txt where fti @@ ts2_to_tsquery('default',:query) order by rank(fti,ts2_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 @@ ts2_to_tsquery('default',:query)"] set stop_words [list] # lovely the search package requires count to be returned but the # service contract definition doesn't specify it! - return [list ids $results_ids stopwords $stop_words count [llength $results_ids]] + return [list ids $results_ids stopwords $stop_words count $count] } ad_proc -public tsearch2::summary {