spring-data-elasticsearch SearchDocumentResponse 源码
spring-data-elasticsearch SearchDocumentResponse 代码
文件路径:/src/main/java/org/springframework/data/elasticsearch/core/document/SearchDocumentResponse.java
/*
* Copyright 2019-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.core.document;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import org.springframework.data.elasticsearch.core.AggregationsContainer;
import org.springframework.data.elasticsearch.core.suggest.response.Suggest;
import org.springframework.lang.Nullable;
/**
* This represents the complete search response from Elasticsearch, including the returned documents.
*
* @author Peter-Josef Meisch
* @since 4.0
*/
public class SearchDocumentResponse {
private final long totalHits;
private final String totalHitsRelation;
private final float maxScore;
@Nullable private final String scrollId;
private final List<SearchDocument> searchDocuments;
@Nullable private final AggregationsContainer<?> aggregations;
@Nullable private final Suggest suggest;
public SearchDocumentResponse(long totalHits, String totalHitsRelation, float maxScore, @Nullable String scrollId,
List<SearchDocument> searchDocuments, @Nullable AggregationsContainer<?> aggregationsContainer,
@Nullable Suggest suggest) {
this.totalHits = totalHits;
this.totalHitsRelation = totalHitsRelation;
this.maxScore = maxScore;
this.scrollId = scrollId;
this.searchDocuments = searchDocuments;
this.aggregations = aggregationsContainer;
this.suggest = suggest;
}
public long getTotalHits() {
return totalHits;
}
public String getTotalHitsRelation() {
return totalHitsRelation;
}
public float getMaxScore() {
return maxScore;
}
@Nullable
public String getScrollId() {
return scrollId;
}
public List<SearchDocument> getSearchDocuments() {
return searchDocuments;
}
@Nullable
public AggregationsContainer<?> getAggregations() {
return aggregations;
}
@Nullable
public Suggest getSuggest() {
return suggest;
}
/**
* A function to convert a {@link SearchDocument} async into an entity. Asynchronous so that it can be used from the
* imperative and the reactive code.
*
* @param <T> the entity type
*/
@FunctionalInterface
public interface EntityCreator<T> extends Function<SearchDocument, CompletableFuture<T>> {}
}
相关信息
spring-data-elasticsearch 源码目录
相关文章
spring-data-elasticsearch Document 源码
spring-data-elasticsearch Explanation 源码
spring-data-elasticsearch MapDocument 源码
spring-data-elasticsearch NestedMetaData 源码
spring-data-elasticsearch SearchDocument 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦