MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / addTextIndex

Method addTextIndex

utilities/noteindexer.cpp:89–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88
89void 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

Callers 1

indexNoteMethod · 0.95

Calls 3

bindValueMethod · 0.80
prepareMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected