BlacklightMoreLikeThis: Blacklight plugin that exposes more-like-this information
Description
The BlacklightMoreLikeThis plugin provides basic support for the Solr MoreLikeThis feature, which provides similar documents for a results set. The primary use case for this plugin is as an element in the document show view, but should be possible to work with it on the index view as well.
Requirements
A Rails app using the Blacklight plugin (tested against post-version 2.5).
Installation
This is a plugin, not a gem (because the structure was copied from existing plugins; in theory, it should be possible to make this a gem in the future).
A couple different ways to get the source into your vendor/plugins directory.
Go into your application directory, and run:
./script/plugin install git://github.com/cbeer/blacklight_more_like_this.git
Later you can run ./script/plugin update blacklight_more_like_this if you like.
Requires git installed on your system. There are other ways to get the plugin in there too.
OR cd $your_app/vendor/plugins git clone git://github.com/cbeer/blacklight_more_like_this.git
Configuration
You should configure solr to provide MoreLikeThis results directly (by editing the response handler <wiki.apache.org/solr/MoreLikeThis>), however some basic support is built into the plugin to provide the proper behaviors anyway, using config in your config/initializers/blacklight_config.rb.
config[:fields] = [“title”, “description”, “author”] config[:count] = 3
Injection
This plugin assumes it is in a Blacklight Rails app, uses Blacklight methods, Rails methods, and standard ruby module includes to inject it’s behaviors into the app.
You can turn off this injection if you like, although it will make the plugin less (or non-) functional unless you manually do similar injection. See lib/blacklight_more_like_this.rb#inject! to see exactly what’s going on.
In any initializer, you can set:
BlacklightMoreLikeThis.omit_inject = true
to turn off all injection. The plugin will be completely non-functional if you do this, of course. But perhaps you could try to re-use some of it’s classes in a non-Blacklight, highly hacked Blacklight, or even non-Rails application this way.
You can also turn off injection of individual components, which could be more useful:
BlacklightMoreLikeThis.omit_inject = {
:solrdocument_mixin => false,
:view_helpers => false
}
Tests
There are none. This is bad I know, sorry.