code: private String createFilterQuery(String fieldName, List<String> vals, boolean all, boolean useQuotes) {
  
          String filterQuery = null;
          if ((vals != null)) {
              if (vals.size() == 1) {
                  if (useQuotes) {
                      filterQuery = fieldName + ":" + "\"" + vals.get(0) + "\"";
                  } else {
                      filterQuery = fieldName + ":" + vals.get(0);
                  }
              } else if (vals.size() > 1) {
                  filterQuery = fieldName + ":(";
                  for (int j = 0; j < vals.size(); j++) {
                      String val;
                      if (useQuotes) {
                          val = "\"" + vals.get(j) + "\"";
                      } else {
                          val = vals.get(j);
                      }
                      filterQuery += val;
                      if (vals.size() > (j + 1)) {
                          if (all) {
                              filterQuery += " AND ";
                          } else {
                              filterQuery += " OR ";
                          }
                      }
                  }
                  filterQuery += ")";
              }
          }
          return filterQuery;
      }
docs: Creates a filter query on the given field name.<p>
  
  Creates and adds a filter query.<p>
  
  @param fieldName the field name to create a filter query on
  @param vals the values that should match for the given field
  @param all <code>true</code> to combine the given values with 'AND', <code>false</code> for 'OR'
  @param useQuotes <code>true</code> to surround the given values with double quotes, <code>false</code> otherwise
  
  @return a filter query String e.g. <code>fq=fieldname:val1</code>