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.15 -r1.16 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 4 Apr 2005 10:38:16 -0000 1.15 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 13 Apr 2005 02:41:53 -0000 1.16 @@ -247,8 +247,9 @@ # remove any spaces between words and operators # all remaining spaces between words turn into & - while {[regsub {([-/@.\d\w\(\)])\s+?([-/@.\d\w\(\)])} $query {\1\&\2} query]} {} - + while {[regexp {([-/@.\d\w\(\)])\s+?([-/@.\d\w\(\)])} $query]} { + regsub {([-/@.\d\w\(\)])\s+?([-/@.\d\w\(\)])} $query {\1\&\2} query + } # if a ! is by itself then prepend & regsub {(\w+?)\s*(!)} $query {\1 \& !} query # if there is )( then insert an & between them Index: openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl 8 Mar 2005 03:22:33 -0000 1.1 +++ openacs-4/packages/tsearch2-driver/tcl/test/tsearch2-driver-procs.tcl 13 Apr 2005 02:41:53 -0000 1.2 @@ -37,6 +37,12 @@ set q "(openacs or test) automated" aa_true "Multiple terms grouped automatic AND '[tsearch2::build_query -query $q]'" \ [string equal "(openacs | test) & automated" \ - [tsearch2::build_query -query $q]] + [tsearch2::build_query -query $q]] + set q "one a two" + aa_true "Single letter elements" \ + [string equal "one & a & two" \ + [tsearch2::build_query -query $q]] + + } }