DATAES-285 - Polishing

* drop superfluous class FieldIndex
* change FieldType text and keyword starting with capital letters

Original commit: 089d7746be2f2fc4a395bd5c814f664729121f21
This commit is contained in:
xhaggi 2018-05-07 13:16:01 +02:00
parent 9c235cd53c
commit ace5a21b05
10 changed files with 33 additions and 48 deletions

View File

@ -1,26 +0,0 @@
/*
* Copyright 2014 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
*
* http://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.annotations;
/**
* @author Artur Konczak
* @author Mohsin Husen
* @author Alexander Volz
* @author Dennis Maaß
*/
public enum FieldIndex {
not_analyzed, analyzed, no
}

View File

@ -21,5 +21,17 @@ package org.springframework.data.elasticsearch.annotations;
* @author Artur Konczak * @author Artur Konczak
*/ */
public enum FieldType { public enum FieldType {
text, Integer, Long, Date, Float, Double, Boolean, Object, Auto, Nested, Ip, Attachment, keyword Text,
Integer,
Long,
Date,
Float,
Double,
Boolean,
Object,
Auto,
Nested,
Ip,
Attachment,
Keyword
} }

View File

@ -16,7 +16,7 @@
package org.springframework.data.elasticsearch.core.facet; package org.springframework.data.elasticsearch.core.facet;
import static org.springframework.data.elasticsearch.annotations.FieldType.Integer; import static org.springframework.data.elasticsearch.annotations.FieldType.Integer;
import static org.springframework.data.elasticsearch.annotations.FieldType.text; import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -36,14 +36,14 @@ public class ArticleEntity {
@Id @Id
private String id; private String id;
private String title; private String title;
@Field(type = text, fielddata = true) @Field(type = Text, fielddata = true)
private String subject; private String subject;
@MultiField( @MultiField(
mainField = @Field(type = text), mainField = @Field(type = Text),
otherFields = { otherFields = {
@InnerField(suffix = "untouched", type = text, store = true, fielddata = true, indexAnalyzer = "keyword"), @InnerField(suffix = "untouched", type = Text, store = true, fielddata = true, indexAnalyzer = "keyword"),
@InnerField(suffix = "sort", type = text, store = true, indexAnalyzer = "keyword") @InnerField(suffix = "sort", type = Text, store = true, indexAnalyzer = "keyword")
} }
) )
private List<String> authors = new ArrayList<>(); private List<String> authors = new ArrayList<>();

View File

@ -19,7 +19,6 @@ import org.springframework.core.style.ToStringCreator;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Parent; import org.springframework.data.elasticsearch.annotations.Parent;
@ -38,7 +37,7 @@ public class ParentEntity {
@Id @Id
private String id; private String id;
@Field(type = FieldType.text, store = true) @Field(type = FieldType.Text, store = true)
private String name; private String name;
public ParentEntity() { public ParentEntity() {
@ -67,10 +66,10 @@ public class ParentEntity {
@Id @Id
private String id; private String id;
@Field(type = FieldType.text, store = true) @Field(type = FieldType.Text, store = true)
@Parent(type = PARENT_TYPE) @Parent(type = PARENT_TYPE)
private String parentId; private String parentId;
@Field(type = FieldType.text, store = true) @Field(type = FieldType.Text, store = true)
private String name; private String name;
public ChildEntity() { public ChildEntity() {

View File

@ -1,7 +1,7 @@
package org.springframework.data.elasticsearch.entities; package org.springframework.data.elasticsearch.entities;
import static org.springframework.data.elasticsearch.annotations.FieldType.*; import static org.springframework.data.elasticsearch.annotations.FieldType.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.text; import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
import java.util.Date; import java.util.Date;
@ -19,7 +19,7 @@ public class SampleDateMappingEntity {
@Id @Id
private String id; private String id;
@Field(type = text, index = false, store = true, analyzer = "standard") @Field(type = Text, index = false, store = true, analyzer = "standard")
private String message; private String message;
@Field(type = Date, format = DateFormat.custom, pattern = "dd.MM.yyyy hh:mm") @Field(type = Date, format = DateFormat.custom, pattern = "dd.MM.yyyy hh:mm")

View File

@ -49,9 +49,9 @@ public class SampleEntity {
@Id @Id
private String id; private String id;
@Field(type = text, store = true, fielddata = true) @Field(type = Text, store = true, fielddata = true)
private String type; private String type;
@Field(type = text, store = true, fielddata = true) @Field(type = Text, store = true, fielddata = true)
private String message; private String message;
private int rate; private int rate;
@ScriptedField @ScriptedField

View File

@ -48,7 +48,7 @@ public class SampleEntityUUIDKeyed {
@Id @Id
private UUID id; private UUID id;
private String type; private String type;
@Field(type = FieldType.text, fielddata = true) @Field(type = FieldType.Text, fielddata = true)
private String message; private String message;
private int rate; private int rate;
@ScriptedField @ScriptedField

View File

@ -15,7 +15,7 @@
*/ */
package org.springframework.data.elasticsearch.entities; package org.springframework.data.elasticsearch.entities;
import static org.springframework.data.elasticsearch.annotations.FieldType.text; import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
@ -26,7 +26,7 @@ import org.springframework.data.elasticsearch.annotations.Field;
@Document(indexName = "test-index-sample-inherited", type = "mapping", shards = 1, replicas = 0, refreshInterval = "-1") @Document(indexName = "test-index-sample-inherited", type = "mapping", shards = 1, replicas = 0, refreshInterval = "-1")
public class SampleInheritedEntity extends AbstractInheritedEntity { public class SampleInheritedEntity extends AbstractInheritedEntity {
@Field(type = text, index = false, store = true, analyzer = "standard") @Field(type = Text, index = false, store = true, analyzer = "standard")
private String message; private String message;
public String getMessage() { public String getMessage() {

View File

@ -15,7 +15,7 @@
*/ */
package org.springframework.data.elasticsearch.entities; package org.springframework.data.elasticsearch.entities;
import static org.springframework.data.elasticsearch.annotations.FieldType.text; import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
@ -31,7 +31,7 @@ public class SampleMappingEntity {
@Id @Id
private String id; private String id;
@Field(type = text, index = false, store = true, analyzer = "standard") @Field(type = Text, index = false, store = true, analyzer = "standard")
private String message; private String message;
private NestedEntity nested; private NestedEntity nested;
@ -54,7 +54,7 @@ public class SampleMappingEntity {
static class NestedEntity { static class NestedEntity {
@Field(type = text) @Field(type = Text)
private String someField; private String someField;
public String getSomeField() { public String getSomeField() {

View File

@ -15,7 +15,7 @@
*/ */
package org.springframework.data.elasticsearch.entities; package org.springframework.data.elasticsearch.entities;
import static org.springframework.data.elasticsearch.annotations.FieldType.text; import static org.springframework.data.elasticsearch.annotations.FieldType.Text;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
@ -31,7 +31,7 @@ public class SampleTransientEntity {
@Id @Id
private String id; private String id;
@Field(type = text, index = false, store = true, analyzer = "standard") @Field(type = Text, index = false, store = true, analyzer = "standard")
private String message; private String message;
@Transient @Transient