1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-28 23:10:46 +00:00

Fix search filter so that titles and tags of binary tiddlers are searched

This commit is contained in:
Jeremy Ruston 2013-10-17 16:34:50 +01:00
parent 951019eacc
commit e11c620c27

View File

@ -748,19 +748,19 @@ exports.search = function(text,options) {
if(!tiddler) {
tiddler = new $tw.Tiddler({title: title, text: "", type: "text/vnd.tiddlywiki"});
}
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type];
if(contentTypeInfo ? contentTypeInfo.encoding === "utf8" : true) {
var match = true;
for(var t=0; t<searchTermsRegExps.length; t++) {
// Search title and body
if(match) {
var tags = tiddler.fields.tags ? tiddler.fields.tags.join("\0") : "";
match = searchTermsRegExps[t].test(tiddler.fields.title) || searchTermsRegExps[t].test(tags) || searchTermsRegExps[t].test(tiddler.fields.text);
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type] || $tw.config.contentTypeInfo["text/vnd.tiddlywiki"];
var match = true;
for(var t=0; t<searchTermsRegExps.length; t++) {
// Search title and body
if(match) {
var tags = tiddler.fields.tags ? tiddler.fields.tags.join("\0") : "";
if(contentTypeInfo.encoding === "utf8") {
match = searchTermsRegExps[t].test(tiddler.fields.title);
}
match = match || searchTermsRegExps[t].test(tags) || searchTermsRegExps[t].test(tiddler.fields.text);
}
return options.invert ? !match : match;
}
return false;
return options.invert ? !match : match;
};
// Loop through all the tiddlers doing the search
var results = [];