doomspork / autocomplete-me

A simple and blazing fast autocomplete micro-service.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AutocompleteMe

A simple and blazing fast micro-service for powering autocompletion.

AutocompleteMe exists because I wanted to create a micro-service that would allow me to replace Google Places Autocomplete on CityLeash.com. I decided to build it with Rack and package it as a gem so it could be mounted easily within another application (e.g. Rails Engine).

Build Status Code Climate Coverage Status Dependency Status

Table of Contents

  1. Getting Started
  2. Data
  3. Warm-up
  4. Testing
  5. Contributing
  6. Author/Contact
  7. License

Getting Started

AutocompleteMe is packaged as a gem so you can easily include it in another project. To start we need to include AutocompleteMe in your Gemfile:

  • gem 'autocomplete-me', github: 'doomspork/autocomplete-me'

If you're using Rails you'll need to modify config/routes.rb to mount the application:

  • mount AutocompleteMe::Service => '/autocomplete'

Data

Any data can be used with AutocompleteMe, and the included warmed-up task, as long as the data can be represented as a JSON object; the keys will be the autocompleted values. Since this project was initially convienced to replace Places Autocomplete there are two tasks included for the purpose of downloading and parsing populated places from the United States Board on Geographic Names' State Federal Codes, which can be found here.

To download and extract the latest AllStatesFedCodes file:

  • bundle exec thor usgs:download

Next we need to parse the individual StateFedCodes into a single JSON file which will be used to the warm-up the cache, by default this will create a places.json file:

  • bundle exec thor usgs:parse

Warm-up

On occassion it may be necessary to warm-up Redis by populating it with both content and indexes. There is a task included to make this process easier by parsing a JSON file:

  • bundle exec thor warm:start JSON_FILE

Testing

I am using RSpec so running the tests is straight forward:

  • bundle exec rspec

Contributing

Features, feedback, and fixes are always welcome! Please make use of Issues and Pull Requests, all code should have test coverage.

Author/Contact

AutocompleteMe is written and maintained by @doomspork.

License

AutocompleteMe is made available under the MIT License.

About

A simple and blazing fast autocomplete micro-service.

License:MIT License


Languages

Language:Ruby 100.0%