Exemple #1
0
 private static HashMap<String, Set<String>> setFQValues(
     HashMap<String, Set<String>> fqComponents, String field, HashSet<String> newValues) {
   Set<String> v =
       fqComponents.containsKey(field) ? fqComponents.get(field) : new HashSet<String>();
   v.addAll(newValues);
   fqComponents.put(field, v);
   return fqComponents;
 }
Exemple #2
0
  private static String composeFQString(HashMap<String, Set<String>> fqComponents) {
    String fqStr = "";
    for (Map.Entry<String, Set<String>> entry : fqComponents.entrySet()) {
      Set<String> values = entry.getValue();
      if (values.remove(NULL_STRING)) {
        fqStr += "-" + entry.getKey() + ":[* TO *] ";
      }
      if (values.size() > 0) {
        String value = StringUtils.join(values, " OR ");
        if (values.size() > 1) {
          value = "(" + value + ")";
        }
        fqStr += "+" + entry.getKey() + ":" + value + " ";
      }
    }

    return fqStr.trim();
  }