Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby
branch: master
Failed to load latest commit information.
app style police fixing indents
db/migrate fixing table type
lib trying to work around bug in ruby 1.9.2 rand
spec see if this sets up travis db or not ;)
.gitignore made some basic tests work yay including factories and coverage, adde…
.rvmrc initial commit after refactoring into a gem, mostly works
.travis.yml third times a charm, trying to get travis to work!
Gemfile
Gemfile.lock bumping to 0.1.9
MIT-LICENSE initial commit after refactoring into a gem, mostly works
README.rdoc readme improvements
Rakefile
indexed_search.gemspec tweaking some optimizations

README.rdoc

IndexedSearch

A rich indexed search engine for Rails written in pure Ruby.

Supports multiple-model searches with ranked results, which encourages one simple text field to search everything. Search works best this way for usability, and long ago Google spoiled everyone to expect this kind of behavior in your app.

Dependencies

  • REQUIRES MYSQL CURRENTLY (plan to suppport others eventually)

  • Ruby 1.9.x

  • Rails 3.x

  • Text for various matcher algorithms.

  • UnicodeUtils for international character case folding.

  • Valium and activerecord-import and each_batched are used internally to speed up some SQL queries.

Features

  • Automatically indexes words as your models change, for quick searching and lookup.

  • Supports indexing multiple models in one index, searching it, and displaying them all together in one ranked list.

  • Extensive control over the indexed importance of each occurrence of each word.

  • Flexible matching architecture, many common algorithms included (exact, stem, soundex, metaphone, and more).

  • Extensive control over how search results aare ranked, for example:

    • Base score is based on the indexed importance of words found.

    • More exact word matches rank higher than more general matches.

    • Results that match multiple terms score higher than results that match fewer.

    • Each model row can have an arbitrary relative score that influences ranking, based on your data.

  • Can easily be configured to support any language (supports every language with spaces between words by default).

  • Many optimizations (which you can tweak) for pre-pruning large result sets, to prevent searches from slowing down as you ccollect more data.

  • Can disable auto-indexing for models that only change with a release cycle, for performance (just rebuild index at release time with rake task).

  • Indexes can be fully rebuilt in-place without causing down time to the search system.

  • Indexes can be blown away and rebuilt from scratch (faster, but causes incomplete results returned until rebuilt)

  • Partial index rebuilding possible by model, scope, or individual row, for special needs.

  • Easy to setup and administrate with generators and rake tasks.

  • No complicated queries: no operators, attribute selectors, etc.

Limitations

  • MySQL only currently! (more eventually in the future)

  • Should use transaction-capable table types (like InnoDB, which is slower than MyISAM) if you use any auto-reindexing capabilities.

  • Searches are boolean only currently, and do not consider how close the resulting words are to each other, and cannot do arbitrary full-text or phrase search. In practice this limitation doesn't seem to hurt much however, because of the extensive control over word importance through other means.

  • Does not yet support multiple wildly-different languages at once, when different word-splitting algorithms must be employed for each different one (they are all supported, just not within the same installation yet).

  • Being a pure Ruby/SQL immplementation, there could be some space and speed disadvantages compared to some other native compiled systems (but this is easier to setup and manage, so..)

  • Proper international language (non-ascii) support in the index requires SQL-style schema dumping set in application.rb, due to database-specific column types.

  • No complicated queries: no operators, attribute selectors, etc. (yes, this is a benefit too)

Documentation

See: Quick-Start-Guide for installation and usage.

For more in-depth explanations and more options, see the full wiki at: github.com/dburry/indexed_search/wiki

Alternatives

  • Postgres text search

  • Sphinx

  • Lucene

  • Other ruby-based ones

TODO: discussion, feature comparisons, and benchmarks

Contributing

If you think you found a bug or want a feature, get involved at github.com/dburry/indexed_search/issues If you'd then like to contribute a patch, use Github's wonderful fork and pull request features.

To set up a full development environment:

  • git clone the repository,

  • have RVM and Bundler installed,

  • then cd into your repo (follow any RVM prompts if this is your first time using that),

  • and run bundle install to pull in all the rest of the development dependencies.

  • After that point, rake -T should be fairly self-explanatory.

Special Thanks

Special thanks to K3 Integrations www.k3integrations.com for paying for some of the work done to make this gem a reality. Companies that support open source are awesome!

License

This library is distributed under the MIT license. Please see the LICENSE file.

Something went wrong with that request. Please try again.