com.googlecode.fascinator.indexer
Class SolrIndexer

java.lang.Object
  extended by com.googlecode.fascinator.indexer.SolrIndexer
All Implemented Interfaces:
Indexer, Plugin

public class SolrIndexer
extends Object
implements Indexer

This plugin provides indexing services for DigitalObjects and payloads in The Fascinator through Apache Solr.

Configuration

Standard configuration table:

Option Description Required Default
uri The URI of the Solr service Yes http://localhost:9997/solr/fascinator
coreName The name of the indexer Yes fascinator
embedded If false, Solr is started as a separate web application. If true, Solr will start in embedded mode which is non-HTTP accessible. Note: that the current version of Solr (1.4) has bugs when running as embedded, version 1.3 is more stable, so it's recommended to keep this option set to false. Yes false

Examples

  1. Using Internal authentication plugin in The Fascinator
             "solr": {
                 "uri": "http://localhost:9997/solr/fascinator",
                 "coreName": "fascinator",
                 "autocommit": false,
                 "embedded": true
             }
     

Rule file

The Solr Indexer takes a rules file to assist it in indexing various content. This allows you to set up indexing rules for individual harvests. For example, harvests that are transformed by the Aperture plugin need indexing on RDF whereas OAI-PMH Harvests probably don't need transforming and the XML DC is indexed.

Wiki Link

None

Author:
Greg Pendlebury

Constructor Summary
SolrIndexer()
           
 
Method Summary
 void annotate(String oid, String pid)
          Index an annotation
 void annotateRemove(String oid)
          Remove all annotations from the index against an object
 void annotateRemove(String oid, String annoId)
          Remove the specified annotation from the index
 void annotateSearch(SearchRequest request, OutputStream response)
          Search for annotations and return the result to the provided stream
 void commit()
          Call a manual commit against the index
 String getId()
          Get the ID of the plugin
 String getName()
          Get the name of the plugin
 PluginDescription getPluginDetails()
          Gets a PluginDescription object relating to this plugin.
 Storage getStorage()
          Return a reference to this plugins instantiated storage layer
 void index(DigitalObject object, Payload payload)
          Index a specific payload
 void index(String oid)
          Index an object and all of its payloads
 void index(String oid, String pid)
          Index a specific payload
 void init(File jsonFile)
          Initialize the plugin
 void init(String jsonString)
          Initialize the plugin
 void remove(String oid)
          Remove the specified object from the index
 void remove(String oid, String pid)
          Remove the specified payload from the index
 void search(SearchRequest request, OutputStream response)
          Perform a Solr search and stream the results into the provided output
 void sendIndexToBuffer(String index, Map<String,List<String>> fields)
          Send the document to buffer directly
 void setCustomParam(String property, String value)
          Set a value in the custom parameters of the indexer.
 void shutdown()
          Shutdown the plugin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SolrIndexer

public SolrIndexer()
Method Detail

getId

public String getId()
Get the ID of the plugin

Specified by:
getId in interface Plugin
Returns:
String : The ID of this plugin

getName

public String getName()
Get the name of the plugin

Specified by:
getName in interface Plugin
Returns:
String : The name of this plugin

getPluginDetails

public PluginDescription getPluginDetails()
Gets a PluginDescription object relating to this plugin.

Specified by:
getPluginDetails in interface Plugin
Returns:
a PluginDescription

init

public void init(String jsonString)
          throws IndexerException
Initialize the plugin

Specified by:
init in interface Plugin
Parameters:
jsonString - The JSON configuration to use as a string
Throws:
IndexerException - if errors occur during initialization

init

public void init(File jsonFile)
          throws IndexerException
Initialize the plugin

Specified by:
init in interface Plugin
Parameters:
jsonFile - A file containing the JSON configuration
Throws:
IndexerException - if errors occur during initialization

setCustomParam

public void setCustomParam(String property,
                           String value)
Set a value in the custom parameters of the indexer.

Parameters:
property - : The index to use
value - : The value to store

shutdown

public void shutdown()
              throws PluginException
Shutdown the plugin

Specified by:
shutdown in interface Plugin
Throws:
PluginException - if any errors occur during shutdown

getStorage

public Storage getStorage()
Return a reference to this plugins instantiated storage layer

Returns:
Storage : the storage API being used

search

public void search(SearchRequest request,
                   OutputStream response)
            throws IndexerException
Perform a Solr search and stream the results into the provided output

Specified by:
search in interface Indexer
Parameters:
request - : A prepared SearchRequest object
response - : The OutputStream to send results to
Throws:
IndexerException - if there were errors during the search

remove

public void remove(String oid)
            throws IndexerException
Remove the specified object from the index

Specified by:
remove in interface Indexer
Parameters:
oid - : The identifier of the object to remove
Throws:
IndexerException - if there were errors during removal

remove

public void remove(String oid,
                   String pid)
            throws IndexerException
Remove the specified payload from the index

Specified by:
remove in interface Indexer
Parameters:
oid - : The identifier of the payload's object
pid - : The identifier of the payload to remove
Throws:
IndexerException - if there were errors during removal

annotateRemove

public void annotateRemove(String oid)
                    throws IndexerException
Remove all annotations from the index against an object

Specified by:
annotateRemove in interface Indexer
Parameters:
oid - : The identifier of the object
Throws:
IndexerException - if there were errors during removal

annotateRemove

public void annotateRemove(String oid,
                           String annoId)
                    throws IndexerException
Remove the specified annotation from the index

Specified by:
annotateRemove in interface Indexer
Parameters:
oid - : The identifier of the object
annoId - : The identifier of the annotation
Throws:
IndexerException - if there were errors during removal

index

public void index(String oid)
           throws IndexerException
Index an object and all of its payloads

Specified by:
index in interface Indexer
Parameters:
oid - : The identifier of the object
Throws:
IndexerException - if there were errors during indexing

index

public void index(String oid,
                  String pid)
           throws IndexerException
Index a specific payload

Specified by:
index in interface Indexer
Parameters:
oid - : The identifier of the payload's object
pid - : The identifier of the payload
Throws:
IndexerException - if there were errors during indexing

index

public void index(DigitalObject object,
                  Payload payload)
           throws IndexerException
Index a specific payload

Parameters:
object - : The payload's object
pid - : The payload
Throws:
IndexerException - if there were errors during indexing

commit

public void commit()
Call a manual commit against the index

Specified by:
commit in interface Indexer

sendIndexToBuffer

public void sendIndexToBuffer(String index,
                              Map<String,List<String>> fields)
Send the document to buffer directly

Parameters:
index -
fields -

annotate

public void annotate(String oid,
                     String pid)
              throws IndexerException
Index an annotation

Specified by:
annotate in interface Indexer
Parameters:
oid - : The identifier of the annotation's object
pid - : The identifier of the annotation
Throws:
IndexerException - if there were errors during indexing

annotateSearch

public void annotateSearch(SearchRequest request,
                           OutputStream response)
                    throws IndexerException
Search for annotations and return the result to the provided stream

Specified by:
annotateSearch in interface Indexer
Parameters:
request - : The SearchRequest object
response - : The OutputStream to send responses to
Throws:
IndexerException - if there were errors during indexing


Copyright © 2009-2012. All Rights Reserved.