private Duration getEffectiveTimeout(final SearchRequest searchRequest) {
        Duration requestedTimeout = searchRequest.getTimeout() == null
                ? null
                : Duration.ofMillis(searchRequest.getTimeout());
        if (requestedTimeout != null) {
            return requestedTimeout;
        } else if (searchRequest.incremental()) {
            // No timeout supplied so they want a response immediately
            return Duration.ZERO;
        }

        // This is synchronous so just use the service's default.
        return FALL_BACK_DEFAULT_TIMEOUT;
    }
Build a {@link SearchResponse} from the passed {@link SearchRequest}.

@param searchRequest The {@link SearchRequest} containing the query terms and the result requests
@return A {@link SearchResponse} object that may be one of:
<ul>
<li>A 'complete' {@link SearchResponse} containing all the data requested</li>
<li>An incomplete {@link SearchResponse} containing none, some or all of the data requested, i.e the
currently know results at the point the request is made.</li>
<li>An empty response with an error message indicating the request timed out waiting for a 'complete'
result set. This only applies to non-incremental queries.</li>
<li>An empty response with a different error message. This will happen when some unexpected error has
occurred while assembling the {@link SearchResponse}</li>
</ul>
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/SearchResponseCreator.java