Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace InternalSearchResponse#EMPTY with InternalSearchResponse#empty() #5775

Merged
merged 1 commit into from Apr 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions rest-api-spec/test/scroll/11_clear.yaml
@@ -1,9 +1,4 @@
---
setup:
- skip:
version: 0 - 999
reason: This test some impacts other tests
---
"Clear scroll":
- do:
indices.create:
Expand Down
Expand Up @@ -140,7 +140,7 @@ protected BaseAsyncAction(SearchRequest request, ActionListener<SearchResponse>
public void start() {
if (expectedSuccessfulOps == 0) {
// no search shards to search on, bail with empty response (it happens with search across _all with no indices around and consistent with broadcast operations)
listener.onResponse(new SearchResponse(InternalSearchResponse.EMPTY, null, 0, 0, System.currentTimeMillis() - startTime, ShardSearchFailure.EMPTY_ARRAY));
listener.onResponse(new SearchResponse(InternalSearchResponse.empty(), null, 0, 0, System.currentTimeMillis() - startTime, ShardSearchFailure.EMPTY_ARRAY));
return;
}
request.beforeStart();
Expand Down
Expand Up @@ -414,7 +414,7 @@ public InternalSearchResponse merge(ScoreDoc[] sortedDocs, AtomicArray<? extends
List<? extends AtomicArray.Entry<? extends FetchSearchResultProvider>> fetchResults = fetchResultsArr.asList();

if (queryResults.isEmpty()) {
return InternalSearchResponse.EMPTY;
return InternalSearchResponse.empty();
}

QuerySearchResult firstResult = queryResults.get(0).value.queryResult();
Expand Down
Expand Up @@ -40,6 +40,10 @@
*/
public class InternalSearchResponse implements Streamable, ToXContent {

public static InternalSearchResponse empty() {
return new InternalSearchResponse(new InternalSearchHits(new InternalSearchHit[0], 0, 0), null, null, null, false);
}

private InternalSearchHits hits;

private InternalFacets facets;
Expand All @@ -50,8 +54,6 @@ public class InternalSearchResponse implements Streamable, ToXContent {

private boolean timedOut;

public static final InternalSearchResponse EMPTY = new InternalSearchResponse(new InternalSearchHits(new InternalSearchHit[0], 0, 0), null, null, null, false);

private InternalSearchResponse() {
}

Expand Down