Sha256: 20c6c822326ea5d13fcb46fa42d8dae7d5d637c0ceb27f1f671f0ea6a17b37da

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

= Quest

Very naive full text search implementation for ActiveRecord based on naive-search by Tomas Jogin (http://github.com/tjogin). Orders results by relevance. Works like this:

* The contents of all the specified fields are stored in a text field.
* Every word in a search query is matched against that text field, in SQL using +like+.
* The returned results are then re-ordered based on how well they match the query and the words the query is made up of.

It Doesn't Scale, much. For situations when more ambitious search solutions are overkill.

== Installation

  gem install quest_search

== Usage

Run the migration generator on your model, like so:

  rails generate quest_search:migration Person

Run it. Then use as follows:

  class Person < ActiveRecord::Base
    quest_search_on :name, :surname, :description
  end

This makes the specified fields searchable like so:

  Person.quest_search_for 'my query'

Optionally, you can specify the order and limit of results to return from the database:

  class Person < ActiveRecord::Base
    quest_search_on :name, :surname, :description, :order => "id desc", :limit => 20
  end

Note that the search results will still be re-ordered based on fuzzy "relevance", this simply specifies how many results to retrieve from the database, and in which order.

== License

This project uses MIT-LICENSE.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quest_search-1.0.1 README.rdoc