This link has been bookmarked by 17 people . It was first bookmarked on 16 Oct 2007, by Harjeet Singh.
-
14 Dec 09
-
18 Nov 09
-
29 May 09
Ian DunlopUsing acts_as_solr Ruby on Rails plugin for searching and faceted browsing. Includes information on pagination
-
12 Feb 09
-
03 Jan 09
-
02 Apr 08
-
12 Feb 08
-
11 Feb 08
-
18 Dec 07
lgsiigoSolr is a search server based on lucene java search library with a HTTP/XML interface. Using Solr, large collections of documents can be indexed based on strongly typed field definitions, thereby taking advantage of Lucene's powerful full-text search feat
-
19 Nov 07
-
27 Oct 07
-
16 Oct 07
-
- name (type:string)
- brand (type:string) [we want faceted browsing on this field]
- resolution (type:float) [we want faceted browsing on this field]
- other fields which we do not want to index
limit: to limit the count of search resultsoffset: starting index of the search results.scores: solr scores for each of the result returnedorder: by which field results should be ordered and in asc/desc order?operator: words in query should be separated by "and" or "or" i.e. all words should exist in matching results or any of the words respectively- If you do not want Camera models objects as results, you can use
find_id_by_solrwhich will return just id's from the Camera table (scoreoption is not supported yet) - The result of
find_by_solris not an array of camera objects. Its a ActsAsSolr::SearchResults object.
acts_as_solr : search and faceting 11
Table of Contents
For more acts_as_solr magic:
Solr and acts_as_solr
Solr is a search server based on lucene java search library with a HTTP/XML interface. Using Solr, large collections of documents can be indexed based on strongly typed field definitions, thereby taking advantage of Lucene's powerful full-text search features.
acts_as_solr is a ruby on rails plugin adding Solr capabilities to activerecord models. It hides all configuration and manual setting efforts with Solr and provides you with simple
find_by...methods. acts_as_solr can be used as a replacement to acts_as_ferret because of inbuilt full text search capabilities ;-) . The purpose of this article is to explain acts_as_solr with examples.
Getting Started
Installation: Installation is well explained on acts_as_solr homepage and getting started with acts_as_solr
Note: acts_as_solr requires jre1.5 on system. Before running any of the solr methods make sure you start solr server with
rake solr:startcommand.Our example model for this tutorial will be DigitalCamera [classname: Camera] with following fields
Basic Usage : for search
Lets start with basic search and then we will move on to faceted browsing. You need to specify which of the columns from your model file you want to be indexed for search (if no:fieldsparam is given, then all columns are indexed) :
Basic search can be done using:1 2 3
class Camera acts_as_solr :fields=>[:name,:brand,:resolution] end
More options can be passed in a hash (2nd argument). Available Options are [@results = Camera.find_by_solr("canon powershot")
:limit, :offset, :scores, :order, :operator]
-
-
24 Sep 07
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.