DATAES-595 - Polishing.

This commit is contained in:
P.J.Meisch 2019-06-21 22:51:15 +02:00
parent 40ea40a763
commit f1aa75a94f
7 changed files with 8 additions and 7 deletions

View File

@ -85,7 +85,6 @@ import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.search.suggest.SuggestBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@ -1287,6 +1286,7 @@ public class ElasticsearchRestTemplate
if (query.getPreference() != null) {
request.preference(query.getPreference());
}
request.source(sourceBuilder);
return request;
}

View File

@ -75,7 +75,6 @@ import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.search.suggest.SuggestBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@ -1074,6 +1073,7 @@ public class ElasticsearchTemplate implements ElasticsearchOperations, EsClient<
if (query.getPreference() != null) {
searchRequestBuilder.setPreference(query.getPreference());
}
return searchRequestBuilder;
}

View File

@ -50,7 +50,6 @@ import org.elasticsearch.search.sort.SortOrder;
import org.reactivestreams.Publisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.NoSuchIndexException;

View File

@ -15,10 +15,12 @@
*/
package org.springframework.data.elasticsearch.core.query;
import static org.springframework.util.CollectionUtils.isEmpty;
import static org.springframework.util.CollectionUtils.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.index.query.QueryBuilder;
@ -235,6 +237,7 @@ public class NativeSearchQueryBuilder {
if (preference != null) {
nativeSearchQuery.setPreference(preference);
}
return nativeSearchQuery;
}
}

View File

@ -15,7 +15,6 @@
*/
package org.springframework.data.elasticsearch.core.query;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -184,6 +183,7 @@ public interface Query {
* Get preference
*
* @return
* @since 3.2
*/
String getPreference();
@ -191,6 +191,7 @@ public interface Query {
* Add preference filter to be added as part of search request
*
* @param preference
* @since 3.2
*/
void setPreference(String preference);
}

View File

@ -62,7 +62,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Version;

View File

@ -45,7 +45,6 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.data.annotation.Id;