@@ -230,8 +230,8 @@ exports.getFilterRunPrefixes = function() {
230230 return this . filterRunPrefixes ;
231231}
232232
233- exports . filterTiddlers = function ( filterString , widget , source ) {
234- var fn = this . compileFilter ( filterString ) ;
233+ exports . filterTiddlers = function ( filterString , widget , source , options ) {
234+ var fn = this . compileFilter ( filterString , options ) ;
235235 try {
236236 const fnResult = fn . call ( this , source , widget ) ;
237237 return fnResult ;
@@ -244,8 +244,11 @@ exports.filterTiddlers = function(filterString,widget,source) {
244244Compile a filter into a function with the signature fn(source,widget) where:
245245source: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)
246246widget: an optional widget node for retrieving the current tiddler etc.
247+ options: optional hashmap of options
248+ options.defaultFilterRunPrefix: the default filter run prefix to use when none is specified
247249*/
248- exports . compileFilter = function ( filterString ) {
250+ exports . compileFilter = function ( filterString , options ) {
251+ var defaultFilterRunPrefix = options ?. defaultFilterRunPrefix || "or" ;
249252 if ( ! this . filterCache ) {
250253 this . filterCache = Object . create ( null ) ;
251254 this . filterCacheCount = 0 ;
@@ -354,7 +357,7 @@ exports.compileFilter = function(filterString) {
354357 var options = { wiki : self , suffixes : operation . suffixes || [ ] } ;
355358 switch ( operation . prefix || "" ) {
356359 case "" : // No prefix means that the operation is unioned into the result
357- return filterRunPrefixes [ "or" ] ( operationSubFunction , options ) ;
360+ return filterRunPrefixes [ defaultFilterRunPrefix ] ( operationSubFunction , options ) ;
358361 case "=" : // The results of the operation are pushed into the result without deduplication
359362 return filterRunPrefixes [ "all" ] ( operationSubFunction , options ) ;
360363 case "-" : // The results of this operation are removed from the main result
0 commit comments