Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

document and add offline index building to changelog

  • Loading branch information...
commit e74615e5bdb0f9b899a5edb9982867c65f4b8e76 1 parent a53beb7
@jamesgolick authored
Showing with 28 additions and 1 deletion.
  1. +5 −1 CHANGELOG.md
  2. +23 −0 README.md
View
6 CHANGELOG.md
@@ -1,7 +1,11 @@
Changelog
=========
-### (0.4.4)
+### 0.5
+
+ * (jamesgolick) Add offline index building.
+
+### 0.4.4
* (jamesgolick) Make it possible to query with order, but no conditions.
* (jamesgolick) Add change tracking. This is mostly to facilitate arbitrary caches.
View
23 README.md
@@ -204,6 +204,29 @@ You can also use any other Friendly::Scope method like scope chaining.
See the section above or the Friendly::Scope docs for more details.
+Offline Indexing
+================
+
+Friendly includes support for building an index in the background, without taking your app offline.
+
+All you have to do is declare the index in your model. If we wanted to add an index on :name, :created_at in a User model, we'd do it like this:
+
+ class User
+ # ...snip...
+
+ indexes :name, :created_at
+ end
+
+Then, make sure to run Friendly.create_tables! to create the table in the database. This won't overwrite any of your existing tables, so don't worry.
+
+ >> Friendly.create_tables!
+
+Now that the the new table has been created, you need to copy the .rake file included with Friendly (lib/tasks/friendly.rake) to somewhere that will get picked up by your main Rakefile (lib/tasks if it's a rails project). Then, run:
+
+ $ KLASS=User FIELDS=name,created_at rake friendly:build_index
+
+If you're running this in production, you'll probably want to fire up GNU screen so that it'll keep running even if you lose your SSH connection. When this task completes, the index is populated and ready to go!
+
Installation
============
Please sign in to comment.
Something went wrong with that request. Please try again.