From 2412dbe599af6ce095527334eea1690b1d2be6a7 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Mon, 8 Feb 2016 17:16:12 +0100 Subject: [PATCH] apply feedback from @colings86 --- .../org/elasticsearch/percolator/PercolateContext.java | 4 ++-- .../percolator/PercolateDocumentParserTests.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/percolator/PercolateContext.java b/core/src/main/java/org/elasticsearch/percolator/PercolateContext.java index 4c7f22e3922..7572ebcba87 100644 --- a/core/src/main/java/org/elasticsearch/percolator/PercolateContext.java +++ b/core/src/main/java/org/elasticsearch/percolator/PercolateContext.java @@ -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() { diff --git a/core/src/test/java/org/elasticsearch/percolator/PercolateDocumentParserTests.java b/core/src/test/java/org/elasticsearch/percolator/PercolateDocumentParserTests.java index ab0e86fd2af..17426f111b3 100644 --- a/core/src/test/java/org/elasticsearch/percolator/PercolateDocumentParserTests.java +++ b/core/src/test/java/org/elasticsearch/percolator/PercolateDocumentParserTests.java @@ -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) {