From 0648698b24375015d98b288d561f904fac92cbd1 Mon Sep 17 00:00:00 2001 From: zell Date: Mon, 15 Oct 2007 18:33:21 +0000 Subject: [PATCH] If the search begins with non-word characters, the array returned by join() will have as its first element. We don't want in the array. So lo, we remove it. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2239 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/jdbc/depot/PostgreSQLBuilder.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/java/com/samskivert/jdbc/depot/PostgreSQLBuilder.java b/src/java/com/samskivert/jdbc/depot/PostgreSQLBuilder.java index 296fefcf..c1a887b2 100644 --- a/src/java/com/samskivert/jdbc/depot/PostgreSQLBuilder.java +++ b/src/java/com/samskivert/jdbc/depot/PostgreSQLBuilder.java @@ -47,6 +47,7 @@ import com.samskivert.jdbc.depot.FieldMarshaller.ObjectMarshaller; import com.samskivert.jdbc.depot.FieldMarshaller.ShortMarshaller; import com.samskivert.jdbc.depot.annotation.FullTextIndex; import com.samskivert.jdbc.depot.operator.Conditionals.FullTextMatch; +import com.samskivert.util.ArrayUtil; import com.samskivert.util.StringUtil; import com.samskivert.Log; @@ -88,6 +89,9 @@ public class PostgreSQLBuilder // 'ho! who goes there?' -> 'ho|who|goes|there' String[] searchTerms = match.getQuery().toLowerCase().split("\\W+"); + if (searchTerms.length > 0 && searchTerms[0].length() == 0) { + searchTerms = ArrayUtil.splice(searchTerms, 0, 1); + } String query = StringUtil.join(searchTerms, "|"); _stmt.setString(_argIdx ++, query); }