Created
August 13, 2011 16:30
-
-
Save chebyte/1144007 to your computer and use it in GitHub Desktop.
index file contents like pdf, html, doc, etc.. using solr, sunspot gem, paperclip, s3 and Rails 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= Sunspot Cell | |
This plugin adds Cell support (for indexing rich documents like pdf, docs, html, etc...) to Sunspot (developed against Sunspot 1.2.1). | |
Support Paperclip and S3 Storage | |
The code is based on the patch included here: | |
http://outoftime.lighthouseapp.com/projects/20339/tickets/98-solr-cell | |
== Requirements | |
* Sunspot gem installed | |
* Solr Cell libraries | |
* Adjustments to the Solr +schema.xml+ | |
== Install | |
=== Get dependencies (Solr Cell libraries & schema.xml) | |
You can get these from: | |
http://www.chebyte.com/solr-chebyte.tgz | |
then in the root rails app descompresses this | |
#root-app> tar -xvzf solr-chebyte.tgz | |
note: if you want to put it manually, you have to put jars in solr/lib and schema.xml in solr/conf | |
=== Install Plugin | |
Add sunspot gem to Gemfile: | |
gem 'sunspot_rails', '~> 1.2.1' | |
Install sunspot cell plugin | |
#root-app> rails plugins install git://github.com/chebyte/sunspot_cell.git | |
== Usage | |
class Doc | |
searchable do | |
text :title | |
attachment :file | |
end | |
end | |
== Paperclip & S3 Storage | |
class Doc | |
searchable do | |
text :title | |
attachment :attached_file | |
end | |
private | |
def attached_file | |
URI.parse(file.expiring_url(60)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The url of http://www.chebyte.com/solr-chebyte.tgz is now a 404/invalid .