             error = NSError(domain: Client.ErrorDomain, code: Int(searchResults.statusCode), userInfo: nil)
         }
         assert(content != nil || error != nil)
-        completionHandler(content: content, error: error)
-    }
-
+        return (content: content, error: error)
+    }
 }

            error = NSError(domain: Client.ErrorDomain, code: Int(searchResults.statusCode), userInfo: nil)
        }
        assert(content != nil || error != nil)
        completionHandler(content: content, error: error)
    }
    
    // ----------------------------------------------------------------------

    }
    
    /// Search the local mirror.
    @objc public func searchMirror(query: Query, completionHandler: CompletionHandler) -> NSOperation {
        let queryCopy = Query(copy: query)
        let callingQueue = NSOperationQueue.currentQueue() ?? NSOperationQueue.mainQueue()
        let operation = NSBlockOperation()
        operation.addExecutionBlock() {
            let (content, error) = self._searchMirror(query)
            callingQueue.addOperationWithBlock() {
                if !operation.cancelled {
                    completionHandler(content: content, error: error)
                }
            }
        }
        self.offlineClient.searchQueue.addOperation(operation)
        return operation
    }
    
    /// Search the local mirror synchronously.
    private func _searchMirror(query: Query) -> (content: [String: AnyObject]?, error: NSError?) {
        assert(!NSThread.isMainThread()) // make sure it's run in the background
        assert(self.mirrored, "Mirroring not activated on this index")
        
