Skip to content

Commit

Permalink
document and add offline index building to changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgolick committed Jan 25, 2010
1 parent a53beb7 commit e74615e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
============

Expand Down

0 comments on commit e74615e

Please sign in to comment.