diff --git a/lib/redis-search.js b/lib/redis-search.js
index <HASH>..<HASH> 100644
--- a/lib/redis-search.js
+++ b/lib/redis-search.js
@@ -55,16 +55,18 @@ Search.prototype.query = function(data, start, stop, callback) {
   for(var index in keyMap) {
     if (keyMap.hasOwnProperty(index)) {
       var keys = keyMap[index];
-      if (keys.length === 1) {
-        tmpKeys.push(keys[0]);
-      } else if (keys.length > 1) {
-        var tmpKeyName = namespace + ':' + index + ':temp';
-        tmpKeys.push(tmpKeyName);
-        var command = commands.and;
-        if (index === 'content' && data.matchWords === 'any') {
-          command = commands.or;
+      if (Array.isArray(keys)) {
+        if (keys.length === 1) {
+          tmpKeys.push(keys[0]);
+        } else if (keys.length > 1) {
+          var tmpKeyName = namespace + ':' + index + ':temp';
+          tmpKeys.push(tmpKeyName);
+          var command = commands.and;
+          if (index === 'content' && data.matchWords === 'any') {
+            command = commands.or;
+          }
+          cmds.push([command, tmpKeyName, keys.length].concat(keys));
         }
-        cmds.push([command, tmpKeyName, keys.length].concat(keys));
       }
     }
   }
don't crash if keys is undefined