mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-06-04 07:34:07 +00:00
FieldIndexer performance: use isShadowTiddler
instead of allTitles
(#7299)
* feat: use `isShadowTiddler` insteadof `allTitles` * fix: use `tiddlerExists` instead
This commit is contained in:
parent
e313857822
commit
8d39ce95eb
@ -32,18 +32,18 @@ FieldIndexer.prototype.setMaxIndexedValueLength = function(length) {
|
|||||||
|
|
||||||
FieldIndexer.prototype.addIndexMethods = function() {
|
FieldIndexer.prototype.addIndexMethods = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
// get all tiddlers, including those overwrite shadow tiddlers
|
||||||
this.wiki.each.byField = function(name,value) {
|
this.wiki.each.byField = function(name,value) {
|
||||||
var titles = self.wiki.allTitles(),
|
var lookup = self.lookup(name,value);
|
||||||
lookup = self.lookup(name,value);
|
|
||||||
return lookup && lookup.filter(function(title) {
|
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) {
|
this.wiki.eachShadow.byField = function(name,value) {
|
||||||
var titles = self.wiki.allShadowTitles(),
|
var lookup = self.lookup(name,value);
|
||||||
lookup = self.lookup(name,value);
|
|
||||||
return lookup && lookup.filter(function(title) {
|
return lookup && lookup.filter(function(title) {
|
||||||
return titles.indexOf(title) !== -1;
|
return self.wiki.isShadowTiddler(title)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
this.wiki.eachTiddlerPlusShadows.byField = function(name,value) {
|
this.wiki.eachTiddlerPlusShadows.byField = function(name,value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user