fix conflicts from merge
This commit is contained in:
parent
d5198b326c
commit
6444194dae
|
@ -142,7 +142,8 @@ public class TransportSuggestAction extends TransportBroadcastAction<SuggestRequ
|
|||
if (parser.nextToken() != XContentParser.Token.START_OBJECT) {
|
||||
throw new IllegalArgumentException("suggest content missing");
|
||||
}
|
||||
final SuggestionSearchContext context = suggestPhase.parseElement().parseInternal(parser, indexService.mapperService(), request.shardId().getIndex(), request.shardId().id(), request);
|
||||
final SuggestionSearchContext context = suggestPhase.parseElement().parseInternal(parser, indexService.mapperService(),
|
||||
indexService.fieldData(), request.shardId().getIndex(), request.shardId().id(), request);
|
||||
final Suggest result = suggestPhase.execute(context, searcher.searcher());
|
||||
return new ShardSuggestResponse(request.shardId(), result);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,6 @@ import org.elasticsearch.index.mapper.MapperService;
|
|||
import java.io.IOException;
|
||||
|
||||
public interface SuggestContextParser {
|
||||
SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService, HasContextAndHeaders headersContext) throws IOException;
|
||||
SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService, IndexFieldDataService indexFieldDataService, HasContextAndHeaders headersContext) throws IOException;
|
||||
|
||||
}
|
|
@ -45,13 +45,13 @@ public final class SuggestParseElement implements SearchParseElement {
|
|||
|
||||
@Override
|
||||
public void parse(XContentParser parser, SearchContext context) throws Exception {
|
||||
SuggestionSearchContext suggestionSearchContext = parseInternal(parser, context.mapperService(),
|
||||
SuggestionSearchContext suggestionSearchContext = parseInternal(parser, context.mapperService(), context.fieldData(),
|
||||
context.shardTarget().index(), context.shardTarget().shardId(), context);
|
||||
context.suggest(suggestionSearchContext);
|
||||
}
|
||||
|
||||
public SuggestionSearchContext parseInternal(XContentParser parser, MapperService mapperService,
|
||||
String index, int shardId, HasContextAndHeaders headersContext) throws IOException {
|
||||
public SuggestionSearchContext parseInternal(XContentParser parser, MapperService mapperService, IndexFieldDataService fieldDataService,
|
||||
String index, int shardId, HasContextAndHeaders headersContext) throws IOException {
|
||||
SuggestionSearchContext suggestionSearchContext = new SuggestionSearchContext();
|
||||
|
||||
BytesRef globalText = null;
|
||||
|
@ -96,7 +96,7 @@ public final class SuggestParseElement implements SearchParseElement {
|
|||
throw new IllegalArgumentException("Suggester[" + fieldName + "] not supported");
|
||||
}
|
||||
final SuggestContextParser contextParser = suggesters.get(fieldName).getContextParser();
|
||||
suggestionContext = contextParser.parse(parser, mapperService, headersContext);
|
||||
suggestionContext = contextParser.parse(parser, mapperService, fieldDataService, headersContext);
|
||||
}
|
||||
}
|
||||
if (suggestionContext != null) {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class CompletionSuggestParser implements SuggestContextParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService,
|
||||
public SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService, IndexFieldDataService fieldDataService,
|
||||
HasContextAndHeaders headersContext) throws IOException {
|
||||
final CompletionSuggestionContext suggestion = new CompletionSuggestionContext(completionSuggester, mapperService, fieldDataService);
|
||||
final ContextAndSuggest contextAndSuggest = new ContextAndSuggest(mapperService);
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class PhraseSuggestParser implements SuggestContextParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService,
|
||||
public SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService, IndexFieldDataService fieldDataService,
|
||||
HasContextAndHeaders headersContext) throws IOException {
|
||||
PhraseSuggestionContext suggestion = new PhraseSuggestionContext(suggester);
|
||||
ParseFieldMatcher parseFieldMatcher = mapperService.getIndexSettings().getParseFieldMatcher();
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class TermSuggestParser implements SuggestContextParser {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService,
|
||||
public SuggestionSearchContext.SuggestionContext parse(XContentParser parser, MapperService mapperService, IndexFieldDataService fieldDataService,
|
||||
HasContextAndHeaders headersContext) throws IOException {
|
||||
XContentParser.Token token;
|
||||
String fieldName = null;
|
||||
|
|
|
@ -54,7 +54,7 @@ public class CustomSuggester extends Suggester<CustomSuggester.CustomSuggestions
|
|||
|
||||
@Override
|
||||
public SuggestContextParser getContextParser() {
|
||||
return (parser, mapperService, headersContext) -> {
|
||||
return (parser, mapperService, fieldData, headersContext) -> {
|
||||
Map<String, Object> options = parser.map();
|
||||
CustomSuggestionsContext suggestionContext = new CustomSuggestionsContext(CustomSuggester.this, options);
|
||||
suggestionContext.setField((String) options.get("field"));
|
||||
|
|
Loading…
Reference in New Issue