code: public String getQueryString(TableSchema tableSchema, Phase phase) throws Exception {
  		StringWriter sw = new StringWriter();
  		PrintWriter pw = new PrintWriter(sw);
  		boolean first = true;
  		for(String fieldName : fieldNames) {
  			if( first ) {
  				pw.print("least(coalesce(nullif(position(lower(?) IN lower(");
  				first = false;
  			} else {
  				pw.print(")),0),9999),coalesce(nullif(position(lower(?) IN lower(");
  			}
  			pw.print(fieldName);
  		}
  		pw.print(")),0),9999))");
  		if( Phase.SELECT == phase ) {
  			pw.print(" AS score");
  		}
  		pw.flush();
  		return sw.toString();
  	}
docs: /*
  least(
  coalesce(
  nullif(
  position(lower(?) IN lower(title))
  ,0
  )
  ,9999
  )
  ,coalesce(
  nullif(
  position(lower(?) IN lower(notes))
  ,0
  )
  ,9999
  )
  ) AS score
  
  coalesce - The COALESCE function returns the first of its arguments that
  is not null. Null is returned only if all arguments are null.
  nullif   - The NULLIF function returns a null value if value1 and value2
  are equal; otherwise it returns value1.