DATAES-46 - Apply code formatting
This commit is contained in:
@@ -28,15 +28,15 @@ import java.lang.annotation.*;
|
||||
@Inherited
|
||||
public @interface CompletionField {
|
||||
|
||||
String searchAnalyzer() default "simple";
|
||||
String searchAnalyzer() default "simple";
|
||||
|
||||
String indexAnalyzer() default "simple";
|
||||
String indexAnalyzer() default "simple";
|
||||
|
||||
boolean payloads() default false;
|
||||
boolean payloads() default false;
|
||||
|
||||
boolean preserveSeparators() default true;
|
||||
boolean preserveSeparators() default true;
|
||||
|
||||
boolean preservePositionIncrements() default true;
|
||||
boolean preservePositionIncrements() default true;
|
||||
|
||||
int maxInputLength() default 50;
|
||||
int maxInputLength() default 50;
|
||||
}
|
||||
|
||||
@@ -53,5 +53,4 @@ public @interface Field {
|
||||
String[] ignoreFields() default {};
|
||||
|
||||
boolean includeInParent() default false;
|
||||
|
||||
}
|
||||
|
||||
@@ -118,9 +118,9 @@ class CriteriaQueryProcessor {
|
||||
}
|
||||
QueryBuilder query = null;
|
||||
|
||||
String searchText = StringUtils.toString(value);
|
||||
String searchText = StringUtils.toString(value);
|
||||
|
||||
switch (key) {
|
||||
switch (key) {
|
||||
case EQUALS:
|
||||
query = queryString(searchText).field(fieldName);
|
||||
break;
|
||||
|
||||
@@ -79,7 +79,7 @@ class MappingBuilder {
|
||||
// Properties
|
||||
XContentBuilder xContentBuilder = mapping.startObject(FIELD_PROPERTIES);
|
||||
|
||||
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY, false, FieldType.Auto,null);
|
||||
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY, false, FieldType.Auto, null);
|
||||
|
||||
return xContentBuilder.endObject().endObject().endObject();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class MappingBuilder {
|
||||
type = fieldType.toString().toLowerCase();
|
||||
}
|
||||
XContentBuilder t = xContentBuilder.startObject(nestedObjectFieldName).field(FIELD_TYPE, type);
|
||||
|
||||
|
||||
if (nestedOrObjectField && FieldType.Nested == fieldType && fieldAnnotation.includeInParent()) {
|
||||
t.field("include_in_parent", fieldAnnotation.includeInParent());
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class MappingBuilder {
|
||||
continue;
|
||||
}
|
||||
boolean nestedOrObject = isNestedOrObjectField(field);
|
||||
mapEntity(xContentBuilder, getFieldType(field), false, EMPTY, field.getName(), nestedOrObject, singleField.type(),field.getAnnotation(Field.class));
|
||||
mapEntity(xContentBuilder, getFieldType(field), false, EMPTY, field.getName(), nestedOrObject, singleField.type(), field.getAnnotation(Field.class));
|
||||
if (nestedOrObject) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,6 @@ package org.springframework.data.elasticsearch.core;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
|
||||
public interface ResultsExtractor<T> {
|
||||
|
||||
T extract(SearchResponse response);
|
||||
}
|
||||
|
||||
@@ -10,48 +10,48 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
public class Completion {
|
||||
|
||||
private String[] input;
|
||||
private String output;
|
||||
private Integer weight;
|
||||
private Object payload;
|
||||
private String[] input;
|
||||
private String output;
|
||||
private Integer weight;
|
||||
private Object payload;
|
||||
|
||||
private Completion() {
|
||||
//required by mapper to instantiate object
|
||||
}
|
||||
private Completion() {
|
||||
//required by mapper to instantiate object
|
||||
}
|
||||
|
||||
public Completion(String[] input) {
|
||||
this.input = input;
|
||||
}
|
||||
public Completion(String[] input) {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
public String[] getInput() {
|
||||
return input;
|
||||
}
|
||||
public String[] getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public void setInput(String[] input) {
|
||||
this.input = input;
|
||||
}
|
||||
public void setInput(String[] input) {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
public String getOutput() {
|
||||
return output;
|
||||
}
|
||||
public String getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public void setOutput(String output) {
|
||||
this.output = output;
|
||||
}
|
||||
public void setOutput(String output) {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
public Object getPayload() {
|
||||
return payload;
|
||||
}
|
||||
public Object getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
||||
public void setPayload(Object payload) {
|
||||
this.payload = payload;
|
||||
}
|
||||
public void setPayload(Object payload) {
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(Integer weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
public void setWeight(Integer weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class Criteria {
|
||||
* @return
|
||||
*/
|
||||
public Criteria is(Object o) {
|
||||
queryCriteria.add(new CriteriaEntry(OperationKey.EQUALS, o));
|
||||
queryCriteria.add(new CriteriaEntry(OperationKey.EQUALS, o));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
||||
* @param repositoryType must not be {@literal null}.
|
||||
* @param beanManager must not be {@literal null}.
|
||||
* @param detector detector for the custom {@link org.springframework.data.repository.Repository} implementations
|
||||
* {@link CustomRepositoryImplementationDetector}, can be {@literal null}.
|
||||
* {@link CustomRepositoryImplementationDetector}, can be {@literal null}.
|
||||
*/
|
||||
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
||||
Class<T> repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) {
|
||||
Class<T> repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) {
|
||||
super(qualifiers, repositoryType, beanManager, detector);
|
||||
|
||||
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ElasticsearchRepositoryExtension extends CdiRepositoryExtensionSupp
|
||||
}
|
||||
|
||||
private <T> CdiRepositoryBean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers,
|
||||
BeanManager beanManager) {
|
||||
BeanManager beanManager) {
|
||||
|
||||
Bean<ElasticsearchOperations> elasticsearchOperationsBean = this.elasticsearchOperationsMap.get(qualifiers
|
||||
.toString());
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
}
|
||||
|
||||
private Criteria from(Part part, Criteria instance, Iterator<?> parameters) {
|
||||
Part.Type type = part.getType();
|
||||
Part.Type type = part.getType();
|
||||
|
||||
Criteria criteria = instance;
|
||||
if (criteria == null) {
|
||||
@@ -126,24 +126,24 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
return criteria.in(asArray(parameters.next()));
|
||||
case NOT_IN:
|
||||
return criteria.in(asArray(parameters.next())).not();
|
||||
case SIMPLE_PROPERTY:
|
||||
case SIMPLE_PROPERTY:
|
||||
case WITHIN: {
|
||||
Object firstParameter = parameters.next();
|
||||
Object secondParameter = null;
|
||||
if(type == Part.Type.SIMPLE_PROPERTY) {
|
||||
if(part.getProperty().getType() != GeoPoint.class)
|
||||
return criteria.is(firstParameter);
|
||||
else {
|
||||
// it means it's a simple find with exact geopoint matching (e.g. findByLocation)
|
||||
// and because Elasticsearch does not have any kind of query with just a geopoint
|
||||
// as argument we use a "geo distance" query with a distance of one meter.
|
||||
secondParameter = ".001km";
|
||||
}
|
||||
} else {
|
||||
secondParameter = parameters.next();
|
||||
}
|
||||
if (type == Part.Type.SIMPLE_PROPERTY) {
|
||||
if (part.getProperty().getType() != GeoPoint.class)
|
||||
return criteria.is(firstParameter);
|
||||
else {
|
||||
// it means it's a simple find with exact geopoint matching (e.g. findByLocation)
|
||||
// and because Elasticsearch does not have any kind of query with just a geopoint
|
||||
// as argument we use a "geo distance" query with a distance of one meter.
|
||||
secondParameter = ".001km";
|
||||
}
|
||||
} else {
|
||||
secondParameter = parameters.next();
|
||||
}
|
||||
|
||||
if (firstParameter instanceof GeoPoint && secondParameter instanceof String)
|
||||
if (firstParameter instanceof GeoPoint && secondParameter instanceof String)
|
||||
return criteria.within((GeoPoint) firstParameter, (String) secondParameter);
|
||||
|
||||
if (firstParameter instanceof Point && secondParameter instanceof Distance)
|
||||
|
||||
Reference in New Issue
Block a user