Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

ychaker/sunspot_admin

Repository files navigation

SunspotAdmin

Introduction

This plugin is created to make managing Solr Search using the Sunspot gem easier. The purpose of this plugin is to provide an admin interface for non-technical people and allow for:

  • Selecting which application models/attributes to index through a simple interface

  • Manual reindexing

  • Starting the Solr server through the web admin

Search Results

By creating partials in your app/views directory you can override how results are displayed.

The default template can be overridden by creating the following file:

app/views/search/_default_display_results.html.haml It is suggested to create a template for each model:

app/views/search/display_results<model_name_lowercase_and_singular>.html.haml

Dependencies

This application is dependent on the following gems:

gem ‘sunspot_rails’, “>= 1.2.rc3” gem ‘haml’ gem “will_paginate”, “~> 3.0.pre2” Use bundle install

to install the required dependencies

for testing and development, the following gems are required:

gem ‘factory_girl_rails’

gem "rspec-rails", "~> 2.0.1"
gem "autotest"
gem "webrat"

Authentication

This plugin is dependent on a presence of an authentication method that uses ‘current_user’ and where the user object responds to the ‘is_admin?’ method. You could use a combination of CanCan and Authlogic or Devise to achieve this.

Solr

To start up a Solr instance manually, issue the following:

rake sunspot:solr:start

Note that using the built-in Solr instance packaged with Sunspot is great for development, but is not recommended for production. See the Sunspot documentation for more information.

Setup

TODO: fix this:

install plugin:

./script/plugin install git://github.com/ychaker/sunspot_admin.git

run migrations:

rake sunspotadmin:db:migrate:up

add the routes to your config/routes.rb:

map.sunspot_admin

Usage

Admin

go to:

/admin/search

to add attributes to be indexed. Once models and attributes have been added to be indexed, click the ‘reindex’ link to reindex your database. I have separated the steps required to get a model indexed in order to allow the admin to add multiple models and fields and then indexing them all at once. Depending on the size of your database, indexing entries make take a while.

go to:

/search to start searching indexed documents. Make sure you have enabled search for at least one model and field from the admin interface.

Version

0.2

Copyright © 2010 Youssef Chaker, released under the MIT license

About

Admin Tool for the Sunspot Gem

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages