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.14 -r1.15 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 10 Mar 2005 01:42:15 -0000 1.14 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 4 Apr 2005 10:38:16 -0000 1.15 @@ -241,11 +241,14 @@ # replace boolean words with boolean operators regsub -nocase "^not " $query {!} query set query [string map {" and " " & " " or " " | " " not " " ! "} " $query "] + # remove leading and trailing spaces so they aren't turned into & set query [string trim $query] + # remove any spaces between words and operators # all remaining spaces between words turn into & - regsub -all {([-/@.\d\w\(\)])\s+?([-/@.\d\w\(\)])} $query {\1 \& \2} query + while {[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