README.rdoc

Sunspot

Sunspot is a Ruby library for expressive, powerful interaction with the
Solr search engine. Sunspot is built on top of the solr-ruby gem, which
provides a low-level interface for Solr interaction; Sunspot provides a
simple, intuitive, expressive DSL backed by powerful features for indexing
objects and searching for them.

Sunspot is designed to be easily plugged in to any ORM, or even
non-database-backed objects such as the filesystem.

If you don't specify a data directory, your Solr index will be stored
in your operating system's temporary directory.

If you specify a solr home, the directory must contain a conf
directory, which should contain at least schema.xml and
solrconfig.xml. Be sure to copy the schema.xml out of the
Sunspot gem's solr/solr/conf directory. Sunspot relies on the
field name patterns defined in the packaged schema.xml, so those
cannot be modified.

You can also run your own instance of Solr wherever you'd like; just
copy the solr/config/schema.xml file out of the gem's solr into your
installation. You can change the URL at which Sunspot accesses Solr with:

Note that in order for a class to be searchable, it must have an adapter
registered for itself or one of its subclasses. Adapters allow Sunspot to
load objects out of persistent storage, and to determine their primary key
for indexing. Sunspot::Rails comes
with an adapter for ActiveRecord objects, but for other types of models you
will need to define your own. See Sunspot::Adapters for more information.

Get data from search:

Building searches manually:

The search DSL is great for building searches from fairly static
parameters, but a highly dynamic search might want to leverage an
intermediate approach (such as an application of the Builder pattern). For
these cases, Sunspot exposes direct access to the Query object:

About the API documentation

All of the methods documented in the RDoc are considered part of
Sunspot's public API. Methods that are not part of the public API are
documented in the code, but excluded from the RDoc. If you find yourself
needing to access methods that are not part of the public API in order to
do what you need, please contact me so I can rectify the situation!