OSDN Git Service

Correct missing wildcard logic.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / REnSearch.java
index 059548e..6079515 100644 (file)
@@ -710,14 +710,20 @@ public class REnSearch {
                NSqlQuery mergeQuery = new NSqlQuery(conn.getConnection());\r
                NSqlQuery deleteQuery = new NSqlQuery(conn.getConnection());\r
                \r
-               indexQuery.prepare("Select distinct guid from words where weight >= " +minimumRecognitionWeight +\r
-               " and word=:word");\r
                insertQuery.prepare("Insert into SEARCH_RESULTS (guid) values (:guid)");\r
                mergeQuery.prepare("Insert into SEARCH_RESULTS_MERGE (guid) values (:guid)");\r
                \r
                if (subSelect) {\r
                        for (int i=0; i<getWords().size(); i++) {\r
-                               indexQuery.bindValue(":word", getWords().get(i));\r
+                               if (getWords().get(i).indexOf("*") == 0) {\r
+                                       indexQuery.prepare("Select distinct guid from words where weight >= " +minimumRecognitionWeight +\r
+                                                       " and word=:word");\r
+                                       indexQuery.bindValue(":word", getWords().get(i));\r
+                               } else {\r
+                                       indexQuery.prepare("Select distinct guid from words where weight >= " +minimumRecognitionWeight +\r
+                                               " and word like :word");\r
+                                       indexQuery.bindValue(":word", getWords().get(i).replace("*", "%"));\r
+                               }\r
                                indexQuery.exec();\r
                                String guid = null;\r
                                while(indexQuery.next()) {\r