mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-20 19:12:11 +00:00
DATAES-46 - Apply code formatting
This commit is contained in:
parent
bb62148bb7
commit
d92137247f
3
pom.xml
3
pom.xml
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
|
@ -53,5 +53,4 @@ public @interface Field {
|
||||
String[] ignoreFields() default {};
|
||||
|
||||
boolean includeInParent() default false;
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
|
||||
case WITHIN: {
|
||||
Object firstParameter = parameters.next();
|
||||
Object secondParameter = null;
|
||||
if(type == Part.Type.SIMPLE_PROPERTY) {
|
||||
if(part.getProperty().getType() != GeoPoint.class)
|
||||
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)
|
||||
|
@ -168,11 +168,11 @@ public class NestedObjectTests {
|
||||
|
||||
final Map mapping = elasticsearchTemplate.getMapping(PersonMultipleLevelNested.class);
|
||||
|
||||
assertThat(mapping,is(notNullValue()));
|
||||
assertThat(mapping, is(notNullValue()));
|
||||
final Map propertyMap = (Map) mapping.get("properties");
|
||||
assertThat(propertyMap,is(notNullValue()));
|
||||
assertThat(propertyMap, is(notNullValue()));
|
||||
final Map bestCarsAttributes = (Map) propertyMap.get("bestCars");
|
||||
assertThat(bestCarsAttributes.get("include_in_parent"),is(notNullValue()));
|
||||
assertThat(bestCarsAttributes.get("include_in_parent"), is(notNullValue()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -171,8 +171,8 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
|
||||
//then
|
||||
assertThat(options.size(), is(2));
|
||||
assertThat(options.get(0).getText().string(), isOneOf("Marchand","Mohsin Husen"));
|
||||
assertThat(options.get(1).getText().string(), isOneOf("Marchand","Mohsin Husen"));
|
||||
assertThat(options.get(0).getText().string(), isOneOf("Marchand", "Mohsin Husen"));
|
||||
assertThat(options.get(1).getText().string(), isOneOf("Marchand", "Mohsin Husen"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -193,14 +193,11 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
for (CompletionSuggestion.Entry.Option option : options) {
|
||||
if (option.getText().string().equals("Mewes Kochheim1")) {
|
||||
assertEquals(Double.MAX_VALUE, option.getPayloadAsDouble(), 0);
|
||||
}
|
||||
else if (option.getText().string().equals("Mewes Kochheim2")) {
|
||||
} else if (option.getText().string().equals("Mewes Kochheim2")) {
|
||||
assertEquals(Long.MAX_VALUE, option.getPayloadAsLong());
|
||||
}
|
||||
else if (option.getText().string().equals("Mewes Kochheim3")) {
|
||||
} else if (option.getText().string().equals("Mewes Kochheim3")) {
|
||||
assertEquals("Payload test", option.getPayloadAsString());
|
||||
}
|
||||
else if (option.getText().string().equals("Mewes Kochheim4")) {
|
||||
} else if (option.getText().string().equals("Mewes Kochheim4")) {
|
||||
assertEquals("Payload", option.getPayloadAsMap().get("someField1"));
|
||||
assertEquals("test", option.getPayloadAsMap().get("someField2"));
|
||||
} else {
|
||||
@ -227,14 +224,11 @@ public class ElasticsearchTemplateCompletionTests {
|
||||
for (CompletionSuggestion.Entry.Option option : options) {
|
||||
if (option.getText().string().equals("Mewes Kochheim1")) {
|
||||
assertEquals(4, option.getScore(), 0);
|
||||
}
|
||||
else if (option.getText().string().equals("Mewes Kochheim2")) {
|
||||
} else if (option.getText().string().equals("Mewes Kochheim2")) {
|
||||
assertEquals(0, option.getScore(), 0);
|
||||
}
|
||||
else if (option.getText().string().equals("Mewes Kochheim3")) {
|
||||
} else if (option.getText().string().equals("Mewes Kochheim3")) {
|
||||
assertEquals(1, option.getScore(), 0);
|
||||
}
|
||||
else if (option.getText().string().equals("Mewes Kochheim4")) {
|
||||
} else if (option.getText().string().equals("Mewes Kochheim4")) {
|
||||
assertEquals(Integer.MAX_VALUE, option.getScore(), 0);
|
||||
} else {
|
||||
fail("Unexpected option");
|
||||
|
@ -48,5 +48,4 @@ public class AbstractInheritedEntity {
|
||||
public void setCreatedDate(Date createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class Person {
|
||||
@Field(type = FieldType.Nested)
|
||||
private List<Car> car;
|
||||
|
||||
@Field(type = FieldType.Nested, includeInParent=true)
|
||||
@Field(type = FieldType.Nested, includeInParent = true)
|
||||
private List<Book> books;
|
||||
|
||||
public String getId() {
|
||||
|
@ -43,7 +43,7 @@ public class PersonMultipleLevelNested {
|
||||
@Field(type = FieldType.Nested)
|
||||
private List<Car> cars;
|
||||
|
||||
@Field(type = FieldType.Nested, includeInParent=true)
|
||||
@Field(type = FieldType.Nested, includeInParent = true)
|
||||
private List<Car> bestCars;
|
||||
|
||||
public String getId() {
|
||||
@ -85,5 +85,4 @@ public class PersonMultipleLevelNested {
|
||||
public void setBestCars(List<Car> bestCars) {
|
||||
this.bestCars = bestCars;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,6 +37,4 @@ public class SampleInheritedEntity extends AbstractInheritedEntity {
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -514,6 +514,7 @@ public class CustomMethodRepositoryTests {
|
||||
assertThat(page, is(notNullValue()));
|
||||
assertThat(page.getTotalElements(), is(equalTo(1L)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldExecuteCustomMethodWithGeoPointAndString() {
|
||||
// given
|
||||
@ -1173,6 +1174,5 @@ public class CustomMethodRepositoryTests {
|
||||
// then
|
||||
assertThat(count, is(equalTo(1L)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -126,5 +126,4 @@ public interface SampleCustomMethodRepository extends ElasticsearchRepository<Sa
|
||||
long countByLocationNear(Point point, Distance distance);
|
||||
|
||||
long countByLocationNear(GeoPoint point, String distance);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user