From c68068fc33ba8acd02f885bb094a14cc28dd1a91 Mon Sep 17 00:00:00 2001 From: Par Winzell 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. --- 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 296fefc..c1a887b 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); }