Exemple #1
0
 public static String getValueFromField(SearchInputDocument doc, String fieldName) {
   SearchInputField field = doc.getField(fieldName);
   if (field == null) {
     return "UNKNOWN";
   } else {
     Object value = field.getFirstValue();
     return (value == null) ? "UNKNOWN" : String.valueOf(value);
   }
 }
Exemple #2
0
  private static StringBuilder format(SearchInputField field, String padding) {
    StringBuilder sb = new StringBuilder();
    sb.append(padding)
        .append(
            "SearchInputField: Name='"
                + field.getName()
                + "', boost='"
                + field.getBoost()
                + "', "
                + field.getValues().size()
                + " values \n");

    for (Object value : field.getValues()) {
      sb.append(padding).append("   '").append(String.valueOf(value)).append("' \n");
    }
    return sb;
  }