public class SolrIndexer extends Object implements Indexer
This plugin provides indexing services for DigitalObjects and payloads in The Fascinator through Apache Solr.
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 |
"solr": {
"uri": "http://localhost:9997/solr/fascinator",
"coreName": "fascinator",
"autocommit": false,
"embedded": true
}
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.
None
| Constructor and Description |
|---|
SolrIndexer() |
| Modifier and Type | Method and Description |
|---|---|
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
|
List<Object> |
getJsonObjectWithField(String fieldName,
String fieldValue) |
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 |
search(SearchRequest request,
OutputStream response,
String format)
Perform a Solr search and stream the results into the provided output format
|
void |
searchByIndex(SearchRequest request,
OutputStream response,
String indexName)
Search the specified solr index (core) and return the result to the
provided stream
|
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
|
public String getId()
public String getName()
public PluginDescription getPluginDetails()
getPluginDetails in interface Pluginpublic void init(String jsonString) throws IndexerException
init in interface PluginjsonString - The JSON configuration to use as a stringIndexerException - if errors occur during initializationpublic void init(File jsonFile) throws IndexerException
init in interface PluginjsonFile - A file containing the JSON configurationIndexerException - if errors occur during initializationpublic void setCustomParam(String property, String value)
property - : The index to usevalue - : The value to storepublic void shutdown()
throws PluginException
shutdown in interface PluginPluginException - if any errors occur during shutdownpublic Storage getStorage()
public void search(SearchRequest request, OutputStream response) throws IndexerException
search in interface Indexerrequest - : A prepared SearchRequest objectresponse - : The OutputStream to send results toIndexerException - if there were errors during the searchpublic void search(SearchRequest request, OutputStream response, String format) throws IndexerException
search in interface Indexerrequest - : A prepared SearchRequest objectresponse - : The OutputStream to send results toformat - : Output format - passed directly to SOlr as the "wt" parameterIndexerException - if there were errors during the searchpublic void remove(String oid) throws IndexerException
remove in interface Indexeroid - : The identifier of the object to removeIndexerException - if there were errors during removalpublic void remove(String oid, String pid) throws IndexerException
remove in interface Indexeroid - : The identifier of the payload's objectpid - : The identifier of the payload to removeIndexerException - if there were errors during removalpublic void annotateRemove(String oid) throws IndexerException
annotateRemove in interface Indexeroid - : The identifier of the objectIndexerException - if there were errors during removalpublic void annotateRemove(String oid, String annoId) throws IndexerException
annotateRemove in interface Indexeroid - : The identifier of the objectannoId - : The identifier of the annotationIndexerException - if there were errors during removalpublic void index(String oid) throws IndexerException
index in interface Indexeroid - : The identifier of the objectIndexerException - if there were errors during indexingpublic void index(String oid, String pid) throws IndexerException
index in interface Indexeroid - : The identifier of the payload's objectpid - : The identifier of the payloadIndexerException - if there were errors during indexingpublic void index(DigitalObject object, Payload payload) throws IndexerException
object - : The payload's objectpid - : The payloadIndexerException - if there were errors during indexingpublic void commit()
public void sendIndexToBuffer(String index, Map<String,List<String>> fields)
index - fields - public void annotate(String oid, String pid) throws IndexerException
annotate in interface Indexeroid - : The identifier of the annotation's objectpid - : The identifier of the annotationIndexerException - if there were errors during indexingpublic void searchByIndex(SearchRequest request, OutputStream response, String indexName) throws IndexerException
searchByIndex in interface Indexerrequest - : The SearchRequest objectresponse - : The OutputStream to send responses toindexName - : The name of the indexIndexerException - if there were errors during indexingpublic void annotateSearch(SearchRequest request, OutputStream response) throws IndexerException
annotateSearch in interface Indexerrequest - : The SearchRequest objectresponse - : The OutputStream to send responses toIndexerException - if there were errors during indexingpublic List<Object> getJsonObjectWithField(String fieldName, String fieldValue) throws IndexerException
getJsonObjectWithField in interface IndexerIndexerExceptionCopyright © 2009-2013. All Rights Reserved.