Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

websolr-acts_as_solr

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websolr-acts_as_solr

  • 1.3.3.1
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

== About

This is the gem to install for the supported version of acts_as_solr on websolr.

== Installation

cd your_rails_app sudo gem install websolr-acts_as_solr config.gem "websolr-acts_as_solr" # into config.environment.rb echo websolr-acts_as_solr >> .gems # if using Heroku acts_as_solr install # Installs config/solr.yml echo "require 'aas_tasks'" >> Rakefile # Installs local development tasks

== Usage

=== Starting a local development server

To start up a Solr instance for development, issue the following:

rake solr:start

=== Using in production

You need to make sure that the WEBSOLR_URL environment variable is set correctly.

If you're using Heroku, this should happen automatically. You can verify by running heroku config.

If you're running in your own environment, set the environment variable as you normally would on a *nix system.

If you have to set the variable in Ruby, you should be able to put the following in an Rails initializer:

if RAILS_ENV == "production" ENV["WEBSOLR_URL"] = "http://index.websolr.com/solr/[your-api-key]" load "websolr-acts_as_solr.rb" end

== Requirements

== Basic Usage

Just include the line below to any of your ActiveRecord models:

acts_as_solr

Or if you want, you can specify only the fields that should be indexed:

acts_as_solr :fields => [:name, :author]

Then to find instances of your model, just do:

Model.find_by_solr(query) #query is a string representing your query

Please see ActsAsSolr::ActsMethods in the RDoc for a complete info

== acts_as_solr in your tests

To test code that uses acts_as_solr you must start a Solr server for the test environment. You can do that with

rake solr:start RAILS_ENV=test

However, if you would like to mock out Solr calls so that a Solr server is not needed (and your tests will run much faster), just add this to your test_helper.rb or similar:

class ActsAsSolr::Post
  def self.execute(request)
    true
  end
end

(via[http://www.subelsky.com/2007/10/actsassolr-capistranhttpwwwbloggercomim.html#c1646308013209805416])

FAQs

Package last updated on 13 Oct 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc