Plugins - Acts as Clusterable

StarAdd to favorites

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)

Surendra K Singhi

http://cuttingtheredtape.blogspot.com/2006/08/actsasclusterable.html

http://clusterer.rubyforge.org/svn/rails-plugins/acts_as_clusterable/

Rails' (MIT)

  • Currently 5.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Searching and Queries

Tags

Comments

Add a comment
Benjamin Curtis 26 Nov 2007

The SVN url has been updated.

Eric Pugh 25 Nov 2007

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 clusterabletest.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/actsas_clusterable/

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?