1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

FieldIndexer performance: use isShadowTiddler instead of allTitles (#7299)

* feat: use `isShadowTiddler` insteadof `allTitles`

* fix: use `tiddlerExists` instead
This commit is contained in:
lin onetwo 2023-02-28 01:32:20 +08:00 committed by GitHub
parent e313857822
commit 8d39ce95eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,18 +32,18 @@ FieldIndexer.prototype.setMaxIndexedValueLength = function(length) {
FieldIndexer.prototype.addIndexMethods = function() {
var self = this;
// get all tiddlers, including those overwrite shadow tiddlers
this.wiki.each.byField = function(name,value) {
var titles = self.wiki.allTitles(),
lookup = self.lookup(name,value);
var lookup = self.lookup(name,value);
return lookup && lookup.filter(function(title) {
return titles.indexOf(title) !== -1;
return self.wiki.tiddlerExists(title)
});
};
// get shadow tiddlers, including shadow tiddlers that is overwritten
this.wiki.eachShadow.byField = function(name,value) {
var titles = self.wiki.allShadowTitles(),
lookup = self.lookup(name,value);
var lookup = self.lookup(name,value);
return lookup && lookup.filter(function(title) {
return titles.indexOf(title) !== -1;
return self.wiki.isShadowTiddler(title)
});
};
this.wiki.eachTiddlerPlusShadows.byField = function(name,value) {