Links
Acts as Clusterable
Categories
Acts as Clusterable
This plugin makes it very easy to cluster active record objects. It can be used for grouping search results (see a similar example http://demo.carrot-search.com/carrot2-webapp/main).
This plugin requires the clusterer Ruby gem.
Add the following lines to your model:
acts_as_clusterable :fields => ['title','text']
if no fields are given then it will use all text and string fields present in the model. Now, doing clustering is as easy as:
clusters = Joke.cluster(:algorithm => :hierarchical)
By default the number of clusters is Math.sqrt(no. of objects), so to get custom no. of clusters give, the no. of clusters as an argument, i.e.,
clusters = Joke.cluster(:algorithm => :hierarchical, :no_of_clusters => 2)
Vitals
| Home | http://cuttingtheredtape.blogspot.com/2006/08/actsasclusterable.html |
|---|---|
| Repository | http://clusterer.rubyforge.org/svn/rails-plugins/acts_as_clusterable/ |
| License | Rails' (MIT) |
| Tags |
clustering
|
| Rating | (2 votes) |
| Owner | Surendra K Singhi |
| Created | 25 August 2006 |
Comments
-
This plugin took a while to get working, and I still don't have it all set, so I ahven't voted yet. Beaware that the README on how to us it is inaccurate.. Look at the clusterable_test.rb test for a better example. Also, teh repository listed up there is incorrect, it is now on a rubyforge site: http://clusterer.rubyforge.org/svn/rails-plugins/acts_as_clusterable/
-
The SVN url has been updated.

