algoliasearch/src/main/java/com/algolia/search/saas/Index.java
public JSONObject search(@Nullable Query query, @Nullable RequestOptions requestOptions) throws AlgoliaException {
        if (query == null) {
            query = new Query();
        }

        String cacheKey = null;
        byte[] rawResponse = null;
        if (isCacheEnabled) {
            cacheKey = query.build();
            rawResponse = searchCache.get(cacheKey);
        }
        try {
            if (rawResponse == null) {
                rawResponse = searchRaw(query, requestOptions);
                if (isCacheEnabled) {
                    searchCache.put(cacheKey, rawResponse);
                }
            }
            return Client._getJSONObject(rawResponse);
        } catch (UnsupportedEncodingException | JSONException e) {
            throw new AlgoliaException(e.getMessage());
        }
    }
public JSONObject search(@Nullable Query query, @Nullable RequestOptions requestOptions) throws AlgoliaException {
        if (query == null) {
            query = new Query();
        }

        String cacheKey = null;
        byte[] rawResponse = null;
        if (isCacheEnabled) {
            cacheKey = query.build();
            rawResponse = searchCache.get(cacheKey);
        }
        try {
            if (rawResponse == null) {
                rawResponse = searchRaw(query, requestOptions);
                if (isCacheEnabled) {
                    searchCache.put(cacheKey, rawResponse);
                }
            }
            return Client._getJSONObject(rawResponse);
        } catch (UnsupportedEncodingException | JSONException e) {
            throw new AlgoliaException(e.getMessage());
        }
    }
public JSONObject search ( @ Nullable Query query , @ Nullable RequestOptions requestOptions ) throws AlgoliaException { if ( query == null ) { query = new Query ( ) ; } String cacheKey = null ; byte [ ] rawResponse = null ; if ( isCacheEnabled ) { cacheKey = query . build ( ) ; rawResponse = searchCache . get ( cacheKey ) ; } try { if ( rawResponse == null ) { rawResponse = searchRaw ( query , requestOptions ) ; if ( isCacheEnabled ) { searchCache . put ( cacheKey , rawResponse ) ; } } return Client . _getJSONObject ( rawResponse ) ; } catch ( UnsupportedEncodingException | JSONException e ) { throw new AlgoliaException ( e . getMessage ( ) ) ; } }
Searches inside the index.

@param requestOptions Request-specific options.
@return a JSONObject containing search results
@throws AlgoliaException
Searches inside the index .