def prepare_mandatory_terms(query)
      # use string split with regex to too-cleverly split into space
      # seperated terms and phrases, keeping phrases as unit.
      terms = query.split %r{[[:space:]]+|("[^"]+")}
      # Wound up with some empty strings, get rid of em
      terms.delete_if {|t| t.blank?}

      terms.collect {|token| "+" + escape_query(token)}.join(" ")
    end
def prepare_mandatory_terms(query)
      # use string split with regex to too-cleverly split into space
      # seperated terms and phrases, keeping phrases as unit.
      terms = query.split %r{[[:space:]]+|("[^"]+")}
      # Wound up with some empty strings, get rid of em
      terms.delete_if {|t| t.blank?}

      terms.collect {|token| "+" + escape_query(token)}.join(" ")
    end
Takes a query string, prepares an ElasticSearch query
 doing what we want:
   * tokenizes into bare words and double-quoted phrases
   * Escapes other punctuation to be literal not ElasticSearch operator.
     (Does NOT do URI escaping)
   * Makes each token mandatory with an ElasticSearch "+" operator prefixed.