while (keepRunning) {\r
idle=true;\r
try {\r
+ //waitSeconds(1);\r
String work = workQueue.take();\r
idle=false;\r
if (work.startsWith("SCAN")) {\r
\r
\r
private void addToIndex(String guid, String word, String type) {\r
- if (!foundWords.contains(word))\r
- foundWords.add(word);\r
+ if (foundWords.contains(word))\r
+ return;\r
StringBuffer buffer = new StringBuffer(word.toLowerCase());\r
for (int i=buffer.length()-1; i>=0; i--) {\r
if (!Character.isLetterOrDigit(buffer.charAt(i)))\r
// We have a good word, now let's trim off junk at the beginning or end\r
if (!foundWords.contains(buffer.toString())) {\r
foundWords.add(buffer.toString());\r
+ foundWords.add(word);\r
conn.getWordsTable().addWordToNoteIndex(guid, buffer.toString(), type, 100);\r
}\r
}\r
for (int i=0; i<notes.size() && !interrupt && keepRunning; i++) {\r
guid = notes.get(i);\r
if (guid != null && keepRunning) {\r
+ //waitSeconds(1);\r
indexNoteContent();\r
}\r
}\r
for (int i=0; i<unindexedResources.size()&& !interrupt && keepRunning; i++) {\r
guid = unindexedResources.get(i);\r
if (keepRunning) {\r
+ //waitSeconds(1);\r
indexResource();\r
}\r
}\r
conn.getNoteTable().noteResourceTable.reindexAll(); \r
}\r
\r
+// private void waitSeconds(int len) {\r
+// QDateTime currentdate = new QDateTime(QDateTime.currentDateTime());\r
+// QDateTime futuredate = new QDateTime(QDateTime.currentDateTime());\r
+// \r
+// while (keepRunning && (futuredate.toTime_t() - currentdate.toTime_t() >=len) ) {\r
+// Thread.yield();\r
+// futuredate = new QDateTime(QDateTime.currentDateTime());\r
+// }\r
+// }\r
}\r