コード例 #1
0
ファイル: SearchExtensions.java プロジェクト: anthonyu/gaelyk
 private static Object getFieldRawValue(Field field) {
   switch (field.getType()) {
     case ATOM:
       return field.getAtom();
     case DATE:
       return field.getDate();
     case HTML:
       return field.getHTML();
     case NUMBER:
       return field.getNumber();
     case TEXT:
       return field.getText();
     case GEO_POINT:
       return field.getGeoPoint();
   }
   return null;
 }
コード例 #2
0
 @Override
 public Map<String, Object> from(ScoredDocument from) {
   Map<String, Object> results = new HashMap<String, Object>();
   results.put("___id___", from.getId());
   for (Field field : from.getFields()) {
     FieldType fieldType = field.getType();
     Object value = null;
     if (FieldType.TEXT.equals(fieldType)) {
       value = field.getText();
     } else if (FieldType.NUMBER.equals(fieldType)) {
       value = field.getNumber();
     } else if (FieldType.DATE.equals(fieldType)) {
       value = field.getDate();
     } else if (FieldType.ATOM.equals(fieldType)) {
       value = field.getAtom();
     } else if (FieldType.HTML.equals(fieldType)) {
       value = field.getHTML();
     } else if (FieldType.GEO_POINT.equals(fieldType)) {
       value = field.getGeoPoint();
     }
     results.put(field.getName(), value);
   }
   return results;
 }