mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-30 15:52:12 +00:00
Polishing
This commit is contained in:
parent
433d52981e
commit
b0c97ccf27
@ -121,8 +121,7 @@ class ResponseConverter {
|
||||
.build();
|
||||
}
|
||||
|
||||
private TemplateResponseData clusterGetComponentTemplateData(
|
||||
ComponentTemplateSummary componentTemplateSummary) {
|
||||
private TemplateResponseData clusterGetComponentTemplateData(ComponentTemplateSummary componentTemplateSummary) {
|
||||
|
||||
var mapping = typeMapping(componentTemplateSummary.mappings());
|
||||
var settings = new Settings();
|
||||
@ -326,7 +325,7 @@ class ResponseConverter {
|
||||
}
|
||||
|
||||
private TemplateResponseData indexGetComponentTemplateData(IndexTemplateSummary indexTemplateSummary,
|
||||
List<String> composedOf) {
|
||||
List<String> composedOf) {
|
||||
var mapping = typeMapping(indexTemplateSummary.mappings());
|
||||
|
||||
Function<IndexSettings, Settings> indexSettingsToSettings = indexSettings -> {
|
||||
|
@ -169,11 +169,10 @@ class SearchDocumentResponseBuilder {
|
||||
|
||||
private static SearchShardStatistics shardsFrom(ShardStatistics shards) {
|
||||
List<ShardFailure> failures = shards.failures();
|
||||
List<SearchShardStatistics.Failure> searchFailures = failures.stream()
|
||||
.map(f -> SearchShardStatistics.Failure.of(f.index(), f.node(), f.status(), f.shard(), null,
|
||||
ResponseConverter.toErrorCause(f.reason())))
|
||||
.toList();
|
||||
return SearchShardStatistics.of(shards.failed(), shards.successful(), shards.total(), shards.skipped(), searchFailures);
|
||||
List<SearchShardStatistics.Failure> searchFailures = failures.stream().map(f -> SearchShardStatistics.Failure
|
||||
.of(f.index(), f.node(), f.status(), f.shard(), null, ResponseConverter.toErrorCause(f.reason()))).toList();
|
||||
return SearchShardStatistics.of(shards.failed(), shards.successful(), shards.total(), shards.skipped(),
|
||||
searchFailures);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -235,9 +234,8 @@ class SearchDocumentResponseBuilder {
|
||||
var phraseSuggest = suggestionES.phrase();
|
||||
var phraseSuggestOptions = phraseSuggest.options();
|
||||
List<PhraseSuggestion.Entry.Option> options = new ArrayList<>();
|
||||
phraseSuggestOptions.forEach(optionES -> options
|
||||
.add(new PhraseSuggestion.Entry.Option(optionES.text(), optionES.highlighted(), optionES.score(),
|
||||
optionES.collateMatch())));
|
||||
phraseSuggestOptions.forEach(optionES -> options.add(new PhraseSuggestion.Entry.Option(optionES.text(),
|
||||
optionES.highlighted(), optionES.score(), optionES.collateMatch())));
|
||||
entries.add(new PhraseSuggestion.Entry(phraseSuggest.text(), phraseSuggest.offset(), phraseSuggest.length(),
|
||||
options, null));
|
||||
});
|
||||
|
@ -235,13 +235,13 @@ public class SearchHitMapping<T> {
|
||||
scrollId = searchHitsImpl.getScrollId();
|
||||
}
|
||||
|
||||
return new SearchHitsImpl<>(searchHits.getTotalHits(), //
|
||||
searchHits.getTotalHitsRelation(), //
|
||||
searchHits.getMaxScore(), //
|
||||
scrollId, //
|
||||
searchHits.getPointInTimeId(), //
|
||||
convertedSearchHits, //
|
||||
searchHits.getAggregations(), //
|
||||
return new SearchHitsImpl<>(searchHits.getTotalHits(),
|
||||
searchHits.getTotalHitsRelation(),
|
||||
searchHits.getMaxScore(),
|
||||
scrollId,
|
||||
searchHits.getPointInTimeId(),
|
||||
convertedSearchHits,
|
||||
searchHits.getAggregations(),
|
||||
searchHits.getSuggest(),
|
||||
searchHits.getSearchShardStatistics());
|
||||
}
|
||||
|
@ -140,16 +140,12 @@ class SearchDocumentResponseBuilderUnitTests {
|
||||
.shard(1)
|
||||
.reason(rb -> rb
|
||||
.reason("this is a mock failure in shards")
|
||||
.causedBy(cbb ->
|
||||
cbb.reason("inner reason")
|
||||
.metadata(Map.of("hello", JsonData.of("world")))
|
||||
)
|
||||
.causedBy(cbb -> cbb.reason("inner reason")
|
||||
.metadata(Map.of("hello", JsonData.of("world"))))
|
||||
.type("reason-type")
|
||||
|
||||
)
|
||||
.status("fail")
|
||||
)
|
||||
))
|
||||
.status("fail"))))
|
||||
.build();
|
||||
|
||||
// act
|
||||
|
Loading…
x
Reference in New Issue
Block a user