From 89819f533f99001ab41a161357bbb8a10e3dcf39 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 17 Oct 2012 14:34:34 +0100 Subject: [PATCH] Added filter to search for text in a given tiddler eg [searchVia[mySearchTermTiddler]] will return all the tiddlers containing the string in the mySearchTermTiddler. --- core/modules/filters.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/modules/filters.js b/core/modules/filters.js index ae26b3662..6c79fc373 100644 --- a/core/modules/filters.js +++ b/core/modules/filters.js @@ -207,6 +207,18 @@ exports.operators = { "for(r=subResults.length-1; r>=0; r--) {if(list.indexOf(title) " + op + " -1) {subResults.splice(r,1);}}"; } }, + "searchVia": { // Search for the string in the operand tiddler + selector: function(operator) { + var op = operator.prefix === "!" ? "true" : "false"; + return "var term = this.getTiddler(\"" + $tw.utils.stringify(operator.operand) + "\").fields.text;" + + "$tw.utils.pushTop(subResults,this.search(term,source," + op + "));"; + }, + filter: function(operator) { + var op = operator.prefix === "!" ? "true" : "false"; + return "var term = this.getTiddler(\"" + $tw.utils.stringify(operator.operand) + "\").fields.text;" + + "$tw.utils.pushTop(subResults,this.search(term,subResults," + op + "));"; + } + }, "field": { // Special handler for field comparisons selector: function(operator) { var op = operator.prefix === "!" ? "!" : "=";