diff --git a/lib/utils.js b/lib/utils.js
index <HASH>..<HASH> 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -4,11 +4,11 @@ var utils = {};
 utils.addFiltersToTerm = function(term, data) {
 	var newTerm = term;
 	if (data.uid && Array.isArray(data.uid) && data.uid.length) {
-		newTerm += ' AND ( ' + data.uid.map(function(uid) { return 'uid_i:' + uid; }).join(' OR ') + ' )';
+		newTerm += (newTerm.length ? ' AND ' : '') + '( ' + data.uid.map(function(uid) { return 'uid_i:' + uid; }).join(' OR ') + ' )';
 	}
 
 	if (data.cid && Array.isArray(data.cid) && data.cid.length) {
-		newTerm += ' AND ( ' + data.cid.map(function(cid) { return 'cid_i:' + cid; }).join(' OR ') + ' )';
+		newTerm += (newTerm.length ? ' AND ' : '') + '( ' + data.cid.map(function(cid) { return 'cid_i:' + cid; }).join(' OR ') + ' )';
 	}
 
 	return newTerm;
updated plugin to query properly if no term is supplied but a uid or cid is