app/models/organizations_query.rb
# restrict query to names with an emphasis on auto-complete.
# rubocop:disable Metrics/MethodLength
restrict query to names with an emphasis on auto-complete.
restrict query to names with an emphasis on auto - complete .
def query_definition
    {
      bool: {
        must: {
          multi_match: {
            type: 'best_fields',
            fields: [
              'name.ngram^5',
              'name.default^5',
              'name.shingle^1',
              'name.snowball^1',
              'alternate_names.ngram^5',
              'alternate_names.default^5',
              'alternate_names.shingle^1',
              'alternate_names.snowball^1'
            ],
            query: params[:term]
          }
        },
        should: {
          match_phrase: {
            name: params[:term]
          }
        }
      }
    }
  end
def query_definition { bool : { must : { multi_match : { type : 'best_fields' , fields : [ 'name.ngram^5' , 'name.default^5' , 'name.shingle^1' , 'name.snowball^1' , 'alternate_names.ngram^5' , 'alternate_names.default^5' , 'alternate_names.shingle^1' , 'alternate_names.snowball^1' ] , query : params [ :term ] } } , should : { match_phrase : { name : params [ :term ] } } } } end
restrict query to names with an emphasis on auto-complete.
restrict query to names with an emphasis on auto - complete .