<commit_before># ElasticsearchAutocomplete

Simple autocomplete for rails models using awesome elasticsearch and tire gem

## Installation

Add this line to your application's Gemfile:

    gem 'elasticsearch_autocomplete'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install elasticsearch_autocomplete

## Basic Usage

```ruby
Specify attributes for autocompletion. By default, this is `name` attribute.
class User < ActiveRecord::Base
  ac_field :full_name
end
```

To find suggestions call `ac_search` method on your class. It return `Tire::Results::Collection`

```ruby
User.ac_search('Alex')
User.ac_search('Alex').map(&:full_name)
=> ['<NAME>', '<NAME>']
```

##

You can specify fields for suggestions search

```ruby
class User < ActiveRecord::Base
  ac_field :full_name, :search_fields => [:full_name, :email]
end
```

For search on localized fields such as `name_en`, `name_ru`

```ruby
class Product < ActiveRecord::Base
  ac_field :name, :localized => true
end
```

If you wand to define settings and mapping fof elasticsearch index yourselves

```ruby
class Product < ActiveRecord::Base
  ac_field :name, :skip_settings => true
end
```<commit_msg>fix readme<commit_after># ElasticsearchAutocomplete

Simple autocomplete for rails models using awesome elasticsearch and tire gem

## Installation

Add this line to your application's Gemfile:

    gem 'elasticsearch_autocomplete'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install elasticsearch_autocomplete

## Basic Usage

Specify attributes for autocompletion. By default, this is `name` attribute.

```ruby
class User < ActiveRecord::Base
  ac_field :full_name
end
```

To find suggestions call `ac_search` method on your class. It return `Tire::Results::Collection` instance.

```ruby
User.ac_search('Alex').map(&:full_name)
=> ['<NAME>', '<NAME>']
```

##

You can specify fields for suggestions search

```ruby
class User < ActiveRecord::Base
  ac_field :full_name, :search_fields => [:full_name, :email]
end
```

For search on localized fields such as `name_en`, `name_ru`

```ruby
class Product < ActiveRecord::Base
  ac_field :name, :localized => true
end
```

If you wand to define settings and mapping for elasticsearch index yourselves

```ruby
class Product < ActiveRecord::Base
  ac_field :name, :skip_settings => true
end
```
{'fraction_non_alphanumeric': 0.10682492581602374, 'fraction_numerical': 0.0, 'mean_word_length': 5.194225721784777, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3416732', 'n_tokens_mistral': 738, 'n_tokens_neox': 689, 'n_words': 255}