Permalink
Browse files

Update README.rdoc

  • Loading branch information...
tjogin committed Nov 7, 2011
1 parent 8e664bb commit 2e4e9c9b6b758b02dfa5d3ac8f77857a8327fe32
Showing with 30 additions and 2 deletions.
  1. +30 −2 README.rdoc
View
@@ -1,3 +1,31 @@
-= StupidSearch
+= NaiveSearch
-This project rocks and uses MIT-LICENSE.
+Very naive full text search implementation for ActiveRecord. 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.
+
+== Examples
+
+ class Person < ActiveRecord::Base
+ naive_search_on :name, :surname, :description
+ end
+
+This makes the specified fields searchable like so:
+
+ Person.search_for 'my query'
+
+Optionally, you can specify the order and limit of results to return from the database:
+
+ class Person < ActiveRecord::Base
+ naive_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.

0 comments on commit 2e4e9c9

Please sign in to comment.