Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
= Sunspot
http://outoftime.github.com/sunspot
Sunspot is a Ruby library for expressive, powerful interaction with the Solr search engine. Sunspot is built on top of the RSolr 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.
=== Features:
== Installation
gem sources -a http://gems.github.com gem install outoftime-sunspot
In order to start the packaged Solr installation, run:
sunspot-solr start -- [-d /path/to/data/directory] [-p port] [-s path/to/solr/home] [--pid-dir=path/to/pid/dir]
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:
Sunspot.config.solr.url = 'http://solr.my.host:9818/solr'
== Rails Integration
The {Sunspot::Rails}[http://github.com/outoftime/sunspot_rails] plugin makes integrating Sunspot into Rails drop-in easy.
== Using Sunspot
=== Define an index:
class Post #... end
Sunspot.setup(Post) do text :title, :body string :author_name integer :blog_id integer :category_ids float :average_rating, :using => :ratings_average time :published_at string :sort_title do title.downcase.sub(/^(an?|the)\W+/, ''/) if title = self.title end end
See Sunspot.setup for more information.
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}[http://github.com/outoftime/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.
=== Search for objects:
search = Sunspot.search Post do keywords 'great pizza' with :author_name, 'Mark Twain' with(:blog_id).any_of [2, 14] with(:category_ids).all_of [4, 10] with(:published_at).less_than Time.now any_of do with(:expired_at).greater_than(Time.now) with(:expired_at, nil) end without :title, 'Bad Title' without bad_instance # specifically exclude this instance from results
paginate :page => 3, :per_page => 15
order_by :average_rating, :desc
facet :blog_id
end
See Sunspot.search for more information.
=== Get data from search:
search.results search.total search.page search.per_page search.facet(:blog_id)
== 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!
== Dependencies
Sunspot has been tested with MRI 1.8.6 and 1.8.7, REE 1.8.6, YARV 1.9.1, and JRuby 1.2.0
== Bugs
Please submit bug reports to http://outoftime.lighthouseapp.com/projects/20339-sunspot
== Further Reading
== Contributors
== License
Sunspot is distributed under the MIT License, copyright (c) 2008-2009 Mat Brown
FAQs
Unknown package
We found that outoftime-sunspot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.