README.md in autosuggest-0.1.0 vs README.md in autosuggest-0.1.1
- old
+ new
@@ -2,10 +2,20 @@
Generate autocomplete suggestions based on what your users search
:tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
+[![Build Status](https://github.com/ankane/autosuggest/workflows/build/badge.svg?branch=master)](https://github.com/ankane/autosuggest/actions)
+
+## Installation
+
+Add this line to your application’s Gemfile:
+
+```ruby
+gem 'autosuggest'
+```
+
## How It Works
#### Start with the most popular queries
```ruby
@@ -51,76 +61,65 @@
```ruby
autosuggest.add_concept "brand", Brand.pluck(:name)
```
-#### Blacklist words
+#### Filter words
-[Profanity](https://github.com/tjackiw/obscenity/blob/master/config/blacklist.yml) is blacklisted by default.
+[Profanity](https://github.com/tjackiw/obscenity/blob/master/config/blacklist.yml) is blocked by default. Add custom words with:
-Add custom words with:
-
```ruby
-autosuggest.blacklist_words ["boom"]
+autosuggest.block_words ["boom"]
```
#### Profit
Get suggestions with:
```ruby
autosuggest.suggestions
```
-Filter queries without results and you’re set.
+Filter queries without results and you’re set. We also prefer to have someone manually approve them by hand.
-We also prefer to have someone manually approve them by hand.
-
## Full Example
```ruby
top_queries = Search.group("LOWER(query)")
.having("COUNT(DISTINCT user_id) >= 5")
.count("DISTINCT user_id")
+product_names = Product.pluck(:name)
+brand_names = Brand.pluck(:name)
autosuggest = Autosuggest.new(top_queries)
-
-# create corpus with product names and brand names
-autosuggest.parse_words Product.pluck(:name)
-brand_names = Brand.pluck(:name)
+autosuggest.parse_words product_names
autosuggest.add_concept "brand", brand_names
-
-# prefer brand names
autosuggest.prefer brand_names
-
-# prevent false positives for duplicates
autosuggest.not_duplicates [["straws", "straus"]]
+autosuggest.block_words ["boom"]
-# blacklist words
-autosuggest.blacklist_words ["boom"]
-
-# print suggestions
puts autosuggest.pretty_suggestions
# or
-p autosuggest.suggestions
+suggestions = autosuggest.suggestions
```
-## Installation
+## History
-Add this line to your application’s Gemfile:
+View the [changelog](https://github.com/ankane/autosuggest/blob/master/CHANGELOG.md)
-```ruby
-gem 'autosuggest'
-```
-
-## TODO
-
-- try Jaro-Winkler for duplicates
-
## Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- [Report bugs](https://github.com/ankane/autosuggest/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/autosuggest/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features
+
+To get started with development:
+
+```sh
+git clone https://github.com/ankane/autosuggest.git
+cd autosuggest
+bundle install
+bundle exec rake test
+```