apply feedback from @colings86

This commit is contained in:
Simon Willnauer 2016-02-08 17:16:12 +01:00
parent 96bcb47fc9
commit 2412dbe599
2 changed files with 6 additions and 6 deletions

View File

@ -139,7 +139,7 @@ public class PercolateContext extends SearchContext {
}
// for testing:
PercolateContext(PercolateShardRequest request, SearchShardTarget searchShardTarget, MapperService mapperService) {
PercolateContext(PercolateShardRequest request, SearchShardTarget searchShardTarget, MapperService mapperService, QueryShardContext queryShardContext) {
super(null);
this.searchShardTarget = searchShardTarget;
this.mapperService = mapperService;
@ -153,7 +153,7 @@ public class PercolateContext extends SearchContext {
this.startTime = 0;
this.numberOfShards = 0;
this.onlyCount = true;
queryShardContext = new QueryShardContext(mapperService.getIndexSettings(), null, null, null, mapperService, null, null, null);
this.queryShardContext = queryShardContext;
}
public IndexSearcher docSearcher() {

View File

@ -104,7 +104,7 @@ public class PercolateDocumentParserTests extends ESTestCase {
.endObject();
Mockito.when(request.source()).thenReturn(source.bytes());
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService);
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService, queryShardContext);
ParsedDocument parsedDocument = parser.parse(request, context, mapperService, queryShardContext);
assertThat(parsedDocument.rootDoc().get("field1"), equalTo("value1"));
}
@ -123,7 +123,7 @@ public class PercolateDocumentParserTests extends ESTestCase {
.endObject();
Mockito.when(request.source()).thenReturn(source.bytes());
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService);
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService, queryShardContext);
ParsedDocument parsedDocument = parser.parse(request, context, mapperService, queryShardContext);
assertThat(parsedDocument.rootDoc().get("field1"), equalTo("value1"));
assertThat(context.percolateQuery(), equalTo(new TermQuery(new Term("field1", "value1"))));
@ -147,7 +147,7 @@ public class PercolateDocumentParserTests extends ESTestCase {
Mockito.when(request.source()).thenReturn(source.bytes());
Mockito.when(request.docSource()).thenReturn(docSource.bytes());
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService);
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService, queryShardContext);
ParsedDocument parsedDocument = parser.parse(request, context, mapperService, queryShardContext);
assertThat(parsedDocument.rootDoc().get("field1"), equalTo("value1"));
assertThat(context.percolateQuery(), equalTo(new TermQuery(new Term("field1", "value1"))));
@ -174,7 +174,7 @@ public class PercolateDocumentParserTests extends ESTestCase {
Mockito.when(request.source()).thenReturn(source.bytes());
Mockito.when(request.docSource()).thenReturn(docSource.bytes());
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService);
PercolateContext context = new PercolateContext(request, new SearchShardTarget("_node", new Index("_index", "_na_"), 0), mapperService, queryShardContext);
try {
parser.parse(request, context, mapperService, queryShardContext);
} catch (IllegalArgumentException e) {