OSDN Git Service

Add automatic wildcard option.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / REnSearch.java
index 3fbbaa8..c6802e6 100644 (file)
@@ -33,6 +33,7 @@ import com.evernote.edam.type.Note;
 import com.evernote.edam.type.Notebook;\r
 import com.evernote.edam.type.Tag;\r
 \r
+import cx.fbn.nevernote.Global;\r
 import cx.fbn.nevernote.sql.driver.NSqlQuery;\r
 import cx.fbn.nevernote.utilities.ApplicationLogger;\r
 \r
@@ -396,10 +397,19 @@ public class REnSearch {
                                searchPhrase=true;\r
                                searchPhrases.add(word.toLowerCase());\r
                        }\r
-                       if (!searchPhrase && pos < 0) \r
-                               if (word != null && word.length() > 0)\r
+                       if (!searchPhrase && pos < 0) {\r
+                               if (word != null && word.length() > 0 && !Global.automaticWildcardSearches())\r
                                        getWords().add(word); \r
+                               if (word != null && word.length() > 0 && Global.automaticWildcardSearches()) {\r
+                                       String wildcardWord = word;\r
+                                       if (!wildcardWord.startsWith("*"))\r
+                                               wildcardWord = "*"+wildcardWord;\r
+                                       if (!wildcardWord.endsWith("*"))\r
+                                               wildcardWord = wildcardWord+"*";\r
+                                       getWords().add(wildcardWord); \r
+                               }\r
 //                             getWords().add("*"+word+"*");           //// WILDCARD\r
+                       }\r
                        if (word.startsWith("intitle:")) \r
                                intitle.add("*"+word+"*");\r
                        if (word.startsWith("-intitle:")) \r