diff --git a/core/modules/filters.js b/core/modules/filters.js index 4e7afa6e5..ad919e65b 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -44,7 +44,7 @@ function parseFilterOperation(operators,filterString,p) { // Any suffix? var colon = operator.operator.indexOf(':'); if(colon > -1) { - operator.field = operator.operator.substring(colon + 1); + operator.suffix = operator.operator.substring(colon + 1); operator.operator = operator.operator.substring(0,colon) || "field"; } // Empty operator means: title @@ -186,7 +186,7 @@ exports.compileFilter = function(filterString) { operator: operator.operator, operand: operand, prefix: operator.prefix, - field: operator.field, + suffix: operator.suffix, regexp: operator.regexp },{ wiki: self, diff --git a/core/modules/filters/field.js b/core/modules/filters/field.js index b3b2d2787..fe626dfa5 100644 --- a/core/modules/filters/field.js +++ b/core/modules/filters/field.js @@ -16,17 +16,17 @@ Filter operator for comparing fields for equality Export our filter function */ exports.field = function(source,operator,options) { - var results = []; + var results = [], + fieldname = (operator.suffix || operator.operator).toLowerCase(); // Function to check an individual title function checkTiddler(title) { var tiddler = options.wiki.getTiddler(title); if(tiddler) { var match, - text = tiddler.getFieldString(operator.field); + text = tiddler.getFieldString(fieldname); if(operator.regexp) { - match = !! operator.regexp.exec(text); - } - else { + match = !!operator.regexp.exec(text); + } else { match = text === operator.operand; } if(operator.prefix === "!") { @@ -38,10 +38,6 @@ exports.field = function(source,operator,options) { } } // Iterate through the source tiddlers - if(!operator.field) { - operator.field = operator.operator; - } - operator.field.toLowerCase(); if($tw.utils.isArray(source)) { $tw.utils.each(source,function(title) { checkTiddler(title);