From d3f4e73f8f4fd8f98b1c65f3c0d0badf7ed46255 Mon Sep 17 00:00:00 2001 From: Doron Somech Date: Wed, 24 Aug 2016 14:58:32 +0300 Subject: [PATCH] add AND option to OR clause --- lib/Connection.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Connection.js b/lib/Connection.js index 292d854e..ed46ec02 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -1869,6 +1869,12 @@ function buildSearchQuery(options, extensions, info, isOrChild) { searchargs += ') ('; searchargs += buildSearchQuery(args[1], extensions, info, true); searchargs += ')'; + } else if (criteria === 'AND' && isOrChild) { + if (args.length < 2) + throw new Error('AND must have more than one argument'); + + searchargs += buildSearchQuery(args[0], extensions, info, true); + searchargs += buildSearchQuery(args.slice(1), extensions, info, false); } else { if (criteria[0] === '!') { modifier += 'NOT ';