algoliasearch/src/offline/java/com/algolia/search/saas/MirroredIndex.java
@Override
    public Request searchAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler) {
        // A non-mirrored index behaves exactly as an online index.
        if (!mirrored) {
            return super.searchAsync(query, requestOptions, completionHandler);
        }
        // A mirrored index launches a mixed offline/online request.
        else {
            final Query queryCopy = new Query(query);
            return new OnlineOfflineSearchRequest(queryCopy, requestOptions, completionHandler).start();
        }
    }
@Override
    public Request searchAsync(@NonNull Query query, @Nullable RequestOptions requestOptions, @NonNull CompletionHandler completionHandler) {
        // A non-mirrored index behaves exactly as an online index.
        if (!mirrored) {
            return super.searchAsync(query, requestOptions, completionHandler);
        }
        // A mirrored index launches a mixed offline/online request.
        else {
            final Query queryCopy = new Query(query);
            return new OnlineOfflineSearchRequest(queryCopy, requestOptions, completionHandler).start();
        }
    }
@ Override public Request searchAsync ( @ NonNull Query query , @ Nullable RequestOptions requestOptions , @ NonNull CompletionHandler completionHandler ) { // A non-mirrored index behaves exactly as an online index. if ( ! mirrored ) { return super . searchAsync ( query , requestOptions , completionHandler ) ; } // A mirrored index launches a mixed offline/online request. else { final Query queryCopy = new Query ( query ) ; return new OnlineOfflineSearchRequest ( queryCopy , requestOptions , completionHandler ) . start ( ) ; } }
Search the online API, falling back to the local mirror if enabled in case of error.

@param query Search query.
@param requestOptions Request-specific options.
@param completionHandler The listener that will be notified of the request's outcome.
@return A cancellable request.
Search the online API falling back to the local mirror if enabled in case of error .