]> source.dussan.org Git - sonarqube.git/commitdiff
Remove some unused constants from IndexField.Type
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 10 Jun 2015 07:42:19 +0000 (09:42 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 10 Jun 2015 07:42:19 +0000 (09:42 +0200)
server/sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
server/sonar-server/src/main/java/org/sonar/server/search/IndexField.java

index 8ad8f75fef0c6c5bb55960d72802a59647b49d55..78dc40c3ac63d475e9cbf03283fcceb77ff8a288 100644 (file)
@@ -144,7 +144,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
 
       @Override
       public DOMAIN next() {
-        if(!hasNext()){
+        if (!hasNext()) {
           throw new NoSuchElementException();
         }
         return toDoc(hits.poll().getSource());
@@ -272,44 +272,23 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
     } else if (field.type() == IndexField.Type.STRING) {
       return mapStringField(field, allowRecursive);
     } else if (field.type() == IndexField.Type.BOOLEAN) {
-      return mapBooleanField(field);
+      return mapBooleanField();
     } else if (field.type() == IndexField.Type.OBJECT) {
       return mapNestedField(field);
     } else if (field.type() == IndexField.Type.DATE) {
-      return mapDateField(field);
+      return mapDateField();
     } else if (field.type() == IndexField.Type.DOUBLE) {
-      return mapDoubleField(field);
-    } else if (field.type() == IndexField.Type.INTEGER) {
-      return mapIntegerField(field);
-    } else if (field.type() == IndexField.Type.LONG) {
-      return mapLongField(field);
-    } else if (field.type() == IndexField.Type.UUID_PATH) {
-      return mapUuidPathField(field);
+      return mapDoubleField();
     } else {
       throw new IllegalStateException("Mapping does not exist for type: " + field.type());
     }
   }
 
-  private static Map mapUuidPathField(IndexField field) {
-    return ImmutableMap.of(
-      "type", "string",
-      "index", "analyzed",
-      "analyzer", "uuid_analyzer");
-  }
-
-  protected Map mapDoubleField(IndexField field) {
+  protected Map mapDoubleField() {
     return ImmutableMap.of("type", "double");
   }
 
-  protected Map mapIntegerField(IndexField field) {
-    return ImmutableMap.of("type", "integer");
-  }
-
-  protected Map mapLongField(IndexField field) {
-    return ImmutableMap.of("type", "long");
-  }
-
-  protected Map mapBooleanField(IndexField field) {
+  protected Map mapBooleanField() {
     return ImmutableMap.of("type", "boolean");
   }
 
@@ -327,7 +306,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
     return mapping;
   }
 
-  protected Map mapDateField(IndexField field) {
+  protected Map mapDateField() {
     return ImmutableMap.of(
       "type", "date",
       "format", "date_time");
@@ -339,7 +318,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
       && (field.isSortable() || field.isSearchable());
   }
 
-  protected Map mapGramsField(IndexField field) {
+  protected Map mapGramsField() {
     return ImmutableMap.of(
       "type", "string",
       "index", "analyzed",
@@ -347,7 +326,7 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
       "search_analyzer", "search_grams");
   }
 
-  protected Map mapWordsField(IndexField field) {
+  protected Map mapWordsField() {
     return ImmutableMap.of(
       "type", "string",
       "index", "analyzed",
@@ -365,9 +344,9 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
     }
     if (field.isSearchable()) {
       if (field.type() != IndexField.Type.TEXT) {
-        mapping.put(IndexField.SEARCH_PARTIAL_SUFFIX, mapGramsField(field));
+        mapping.put(IndexField.SEARCH_PARTIAL_SUFFIX, mapGramsField());
       }
-      mapping.put(IndexField.SEARCH_WORDS_SUFFIX, mapWordsField(field));
+      mapping.put(IndexField.SEARCH_WORDS_SUFFIX, mapWordsField());
     }
     mapping.put(field.field(), mapField(field, false));
     return mapping;
index 6c378e17e76f4e761ce2a98d1a089a69d6e17f21..319cee3e8bb73f8f9f0bc6c8fa2437b82dd42a20 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Collections;
 public class IndexField {
 
   public enum Type {
-    STRING, TEXT, DATE, BOOLEAN, INTEGER, LONG, DOUBLE, OBJECT, UUID_PATH
+    STRING, TEXT, DATE, BOOLEAN, DOUBLE, OBJECT
   }
 
   public static final String SORT_SUFFIX = "sort";