Monday, October 19, 2009

BrokenCompass - Install instructions

BrokenCompass up and running in flat 5 mins

Step: 01
Install BrokenCompass plugin
ruby script/plugin install http://brokencompass.googlecode.com/svn/trunk
from inside of rails app root directory.

Step: 02
Add BrokenCompass configuration yml file
Create file
config/brokencompass.yml

Add content like
#brokencompass.yml............. STARTS
index-sources:
advertisment:
sql: "select id,title,description,location from advertisments"
table_name: advertisments

query:
sql: "select id,content,dynamic_fields from queries"
table_name: queries

# Database connection adapter
connection_adapter:
adapter: "mysql"
host: "localhost"
username: "username"
password: "password"
database: "myapp_development"

#brokencompass.yml............. ENDS

Note:
0. Nothing is optional in the yml(everything is mandatory)
1. Add as many items in index-sources as you want, but every item name should match model names(for which they will be used).
2. Make sure to include the Id field so that index created can be mapped to record identifier.
3. Provide the connection adapter details in connection_adapter section(so as to answer, where to read data from)
4. If you are not minding the spaces in yml(then you have messed up the configuration, so don't try to remove spaces :) from yml, wanna know more about yml? )


Step: 03
Run rake task to create indexes for the first time
rake brokencompass:create_index
from inside of rails app root directory.

Step: 04 (This is required, when one is re-creating the indexes from scratch)
Run rake task to re-create indexes
rake brokencompass:index
from inside of rails app root directory.

Step: 05 (To delete any of the indexes so created, delete corresponding "xxxx.index" file from broken_compass
from inside of rails app root directory.

No comments:

Post a Comment

Sky diving! What it feels like.

Writing a new post after almost a year :) Penning it down here.. so that can relive that moment when i did the jump from 10000 feet up in...