| 87 | |
| 88 | |
| 89 | void NoteIndexer::addTextIndex(int lid, QString content) { |
| 90 | // Delete any old content |
| 91 | NSqlQuery sql(db); |
| 92 | sql.prepare("Delete from SearchIndex where lid=:lid and source=:source"); |
| 93 | sql.bindValue(":lid", lid); |
| 94 | sql.bindValue(":source", "text"); |
| 95 | sql.exec(); |
| 96 | |
| 97 | // Add the new content. it is basically a text version of the note with a weight of 100. |
| 98 | sql.prepare("Insert into SearchIndex (lid, weight, source, content) values (:lid, :weight, :source, :content)"); |
| 99 | sql.bindValue(":lid", lid); |
| 100 | sql.bindValue(":weight", 100); |
| 101 | sql.bindValue(":source", "text"); |
| 102 | if (!global.forceSearchLowerCase) |
| 103 | sql.bindValue(":content", content); |
| 104 | else |
| 105 | sql.bindValue(":content", content.toLower()); |
| 106 | sql.exec(); |
| 107 | |
| 108 | sql.prepare("Delete from DataStore where lid=:lid and key=:key"); |
| 109 | sql.bindValue(":lid", lid); |
| 110 | sql.bindValue(":key", NOTE_INDEX_NEEDED); |
| 111 | sql.exec(); |
| 112 | } |
| 113 | |
| 114 | |
| 115 | |