DATAES-39 : SearchResultMapper support for scroll and queryForPage
This commit is contained in:
@@ -310,6 +310,17 @@ public interface ElasticsearchOperations {
|
||||
*/
|
||||
<T> Page<T> scroll(String scrollId, long scrollTimeInMillis, Class<T> clazz);
|
||||
|
||||
/**
|
||||
* Scrolls the results for give scroll id using custom result mapper
|
||||
*
|
||||
* @param scrollId
|
||||
* @param scrollTimeInMillis
|
||||
* @param mapper
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
<T> Page<T> scroll(String scrollId, long scrollTimeInMillis, SearchResultMapper mapper);
|
||||
|
||||
/**
|
||||
* more like this query to search for documents that are "like" a specific document.
|
||||
*
|
||||
|
||||
@@ -367,6 +367,13 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
|
||||
return resultsMapper.mapResults(response, clazz, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Page<T> scroll(String scrollId, long scrollTimeInMillis, SearchResultMapper mapper) {
|
||||
SearchResponse response = client.prepareSearchScroll(scrollId)
|
||||
.setScroll(TimeValue.timeValueMillis(scrollTimeInMillis)).execute().actionGet();
|
||||
return mapper.mapResults(response, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Page<T> moreLikeThis(MoreLikeThisQuery query, Class<T> clazz) {
|
||||
int startRecord = 0;
|
||||
|
||||
Reference in New Issue
Block a user