This is the one-and-only documentation page for the Fedora Generic Search Service, abbreviated fedoragsearch or GSearch.

You, the reader, are presumably responsible for or involved in making your digital contents in Fedora searchable for your end-users. GSearch makes this task relatively easy.

GSearch comes with three plugins for top-class open-source search engines, Apache Lucene, Apache Solr, and Zebra.

Your choice of search engine plugin depends on circumstances:

The choice is taken by configuration.

The presentation at Open Repositories Conference 2012 about complex use cases also contains some introductory material.

Table of Contents

I. DEMONSTRATION
      See a demo at your own site, almost out-of-the-box
II. OVERALL DESCRIPTION
      Major features
      More on the updateIndex operation
      Search engine plugins
III. CONFIGURATION
      Install and configure for your application
      Create the configuration files
      Generate indexing stylesheet from example foxml files
      Edit and use the basic property values
      Edit and use the basic property values for Islandora
      Experimental Drupal module for Islandora
      Configuring GSearch and Fedora for automatic updates
      Multilingual configuration
      GSearch and Fedora on different servers
      Debugging the indexing stylesheet
IV. FURTHER USAGE
      Full-text and metadata extraction from datastreams using Apache Tika
      Customizable end-user search client
      Search result filtering
      Management of GSearch configurations in Fedora objects
      Many-to-many relationship between Fedora objects and index documents
      Many-to-many relationship between repositories and indexes
      Embedded queries
      Building from source
V. HISTORY
      New features in version 2.5
      New features in version 2.4.2
      New features in version 2.4.1
      New features in version 2.4
      New features in version 2.3
      New features in version 2.2
      New features in version 2.1.1
      New features in version 2.1
      New features in version 2.0
      Background

I. DEMONSTRATION

See a demo at your own site, almost out-of-the-box

Perform these steps:

II. OVERALL DESCRIPTION

Major features

The service has the following major features:

You are encouraged to share problems and experience with the Fedora community, send mail to fedora-commons-users, or to Gert Schmeltz Pedersen.

The following figure serves to give a first understanding for a developer, who will use GSearch in a Fedora application:

The figure shows:

GSearch may run in a separate web server and may index more than one Fedora repository, and it may update more than one index in parallel.

XSLT stylesheets are part of the configuration of GSearch, and XSLT transformations play an essential role in the workflow:

More on the updateIndex operation

Search engine plugins

Lucene

The Lucene plugin comes in fedoragsearch.war as the java package dk.defxws.fgslucene together with the Apache Lucene java libraries.

The Lucene plugin is configured during Edit and use the basic property values below, resulting in the set of GSearch configuration files.

Lucene has a very rich functionality, and this plugin allows you to configure many of its options, while all the other options are used with their default values. As a java programmer, you may have ideas for further exploitation, which you may realize by implementing an enhanced version of the plugin. Please, share such ideas and implementations with the Fedora community.

Solr

The Solr server is downloaded, installed and configured as described at the Solr web site.

The Solr server uses the Lucene java libraries for indexing and search.

The Solr plugin comes in fedoragsearch.war as the java package dk.defxws.fgssolr

The Solr plugin is configured during Edit and use the basic property values below, resulting in the set of GSearch configuration files.

The Solr plugin has dependencies on the configuration of the Solr server. You should begin with the schema.xml file provided by GSearch in FgsConfig/FgsConfigIndexTemplate/Solr/conf/schema-3.6.1-for-fgs-2.5.xml . It has a few modifications aimed at the Fedora demo objects. You should uncomment the autoCommit element in solrconfig.xml and set values to 1. Besides, you need to go through all the Solr conf files and make sure they match the index documents generated by your GSearch indexing stylesheet.

This plugin indexes documents via the HTTP POST interface of Solr. Searches may be performed via the Solr native HTTP GET to the Solr server and via gfindObjects, which accesses the Lucene index directly.

Solr functionality does not include browsing, however, this is offered by the plugin via the browseIndex operation, which also accesses the Lucene index directly.

Zebra

The Zebra plugin comes in fedoragsearch.war as the java package dk.defxws.fgszebra .

The Zebra plugin is used by configuration as seen from FgsConfig/FgsConfigIndexTemplate/Zebra/zebraconfig, which includes a README file, which explains how to get and install Zebra, and how to configure it.

III. CONFIGURATION

Install and configure for your application

Perform these steps:

Configuring GSearch and Fedora for automatic updates

By default, GSearch is configured for automatic updates through Fedora notifications. For deeper understanding and modification, see the property fedoragsearch.updaternames in fedoragsearch.properties, and updater.properties in config/updater/FgsUpdaters

By default, Fedora is NOT configured for automatic updates through notifications to GSearch.

In order to configure Fedora for automatic updates through notifications to GSearch, set the value of the param enabled to true for the Messaging module in fedora.fcfg:

<module role="org.fcrepo.server.messaging.Messaging" class="org.fcrepo.server.messaging.MessagingModule">
    <comment>Fedora's Java Messaging Service (JMS) Module</comment>
    <param name="enabled" value="true"/>

As a deprecated alternative to updates via messaging, it is possible to configure Fedora to send a signal via REST to GSearch, when objects are added, modified, and purged. Do NOT enable both alternatives.
To enable REST-based updates, edit your fedora.fcfg file and change the class of the fedora.server.storage.DOManager module to org.fcrepo.server.storage.GSearchDOManager. Then populate the following module parameters as needed:

Multilingual configuration

Add the attribute

URIEncoding="UTF-8"
to .../tomcat/conf/server.xml and to .../tomcat/conf/server_fedoraTemplate.xml in order to search special characters like the Spanish "ñ", "í" etc. (thanks to Luis Zorita).

GSearch and Fedora on different servers

If GSearch and Fedora are running on different servers, then recreating the index with the updateIndex fromFoxmlFiles operation is affected, because the fgsrepository.fedoraObjectDir property has to point to a location on the GSearch server, whereas the object directory is on the Fedora server. Therefore, before recreating the index, you have to copy the object directory from the Fedora server onto the GSearch server at the location given by the property.

Whether GSearch and Fedora are running on different servers or not, the automatic update of the index is done by the updateIndex fromPid operation as triggered by Fedora's JMSprovider, which is configured in fedora.fcfg and in the GSearch updater.properties.

Debugging the indexing xslt stylesheet

When you customize the indexing xslt stylesheet, you might test it from command line with xalan or xsltproc or similar. There is a much larger overhead, if you test it through the GSearch REST API, and often there is no information from the xslt processor, when it simply does not find things that you specify with xpath. It is then better to experiment with the xslt and rerun it from command line, building up piecewise both on the foxml and the xslt in order to experiment.

Here is the command line to run with xalan, provided by Serhiy Polyakov.

IV. FURTHER USAGE

Full-text and metadata extraction from datastreams using Apache Tika

Parameters for getDatastreamFromTika, getDatastreamTextFromTika, and getDatastreamMetadataFromTika
indexFieldTagNameeither "IndexField" (with the Lucene plugin) or "field" (with the Solr plugin)
textIndexField
(not used with getDatastreamMetadataFromTika)
fieldSpec for the text index field, null or empty if not to be generated
indexfieldnamePrefix
(not used with getDatastreamTextFromTika)
optional or empty, prefixed to the metadata index field names
selectedFields
(not used with getDatastreamTextFromTika)
comma-separated list of metadata fieldSpecs, if empty then all fields are included with default params
fieldSpecmetadataFieldName [ '=' indexFieldName] [ '/' [index] [ '/' [store] [ '/' [termVector] [ '/' [boost]]]]]
- metadataFieldNamemust be exactly as extracted by Tika from the document. You may see the available names, if you log in debug mode and look for "METADATA name=" under "fullDsId=" in the log, when "getFromTika" was called during updateIndex
- indexFieldNameis used as the generated index field name. If not given, GSearch uses metadataFieldName after replacement of the characters ' ', ':', '/', '=', '(', ')', '&' with '_'
- the following parameters are used with Lucene (with Solr these values are specified in schema.xml)
- index[ 'TOKENIZED' | 'UN_TOKENIZED' ]
# first alternative is default
- store[ 'YES' | 'NO' ]
# first alternative is default
- termVector[ 'YES' | 'NO' ]
# first alternative is default
- boost<decimal number>
# '1.0' is default

Customizable end-user search client

The download contains the following files in webapps/fedoragsearch/ that you may customize:

Search result filtering

Search result filtering will show only those search hits that the user is actually permitted to read. Three solutions have been investigated and demonstrated and presented here. Besides, the demonstration is included with the GSearch distribution in .../WEB-INF/classes/configDemoSearchResultFiltering/ . In brief, the three solutions are:

Both in-search and pre-search filtering face the challenge of exact correspondence between the filtering mechanism and the XACML policies.

For your own purpose, in fedoragsearch.properties, you have to select the preferred searchResultFilteringType and set the searchResultFilteringModule to a class that you have to program, as a subclass of the demo class dk.defxws.fedoragsearch.server.SearchResultFilteringDemoImpl or as an implementation of the interface dk.defxws.fedoragsearch.server.SearchResultFiltering .

Management of GSearch configurations in Fedora objects

Many-to-many relationship between Fedora objects and index documents

Many-to-many relationship between repositories and indexes

Embedded queries

This is a mechanism that allows you to embed risearch queries in Lucene or Solr queries, and vice versa.

This provides interaction with the Resource Index, both when you index and when you search.

It compensates for the lack of joins in bibliographic query languages like in Lucene and Solr,

and it compensates for the lack of text search functionality in logic languages like the risearch query languages.

The full potential of this mechanism still has to be explored and realized.

These preliminary examples show some of the potential:

Building from source

Get the source from github:

  git clone https://github.com/fcrepo/gsearch.git

To build fedoragsearch.war in FgsBuild/fromsource for normal installation:

  cd FedoraGenericSearch
  ant buildfromsource

To build fedoragsearch.war in FgsBuild/localtest for local testing:

  cd FedoraGenericSearch
  ant -Dlocal.PROTOCOL=<protocol> -Dlocal.HOSTPORT=<hostport> -Dlocal.FEDORA_HOME=<location> -Dlocal.SOLR_HOME=<location> -Dlocal.SOLR_SERVER=<url> buildforlocaltest

The fedoragsearch.war for local testing contains a set of configurations that are used by the test operations below. You may want to run the test operations, if you are customizing the GSearch code.

To run tests in tomcat at <protocol>://<hostport>/fedoragsearch install a Fedora repository with demo objects with MessagingModule enabled, and create a test user in fedora-users.xml :

    <user name="fgsTester" password="fgsTesterPassword">
      <attribute name="fedoraRole">
        <value>tester</value>
      </attribute>
    </user>

Test operations on the lucene plugin:

    ant junit-lucene  
    ant junit-testsonlucene
    ant junit-fgs23  
    ant junit-lucene-fgs24_1010 
    ant junit-lucene-fgs24_1019  
    ant junit-lucene-fgs242_1076
    ant junit-lucene-fgs242_1083  

Test operations on the solr plugin, after startup of the solr server:

    ant junit-solr
    ant junit-solr-fgs24_1010  

Test operations on the zebra plugin, install, configure and startup the zebra server:

    see $FEDORA_HOME/tomcat/webapps/fedoragsearch/WEB-INF/classes/configDemoOnZebra/index/DemoOnZebra/zebraconfig/README
    ant junit-zebra

V. HISTORY

New features in version 2.5

New features in version 2.4.2

New features in version 2.4.1

New features in version 2.4

You may also see the complete list of issues for GSearch.

New features in version 2.3

You may also see the complete list of issues for GSearch 2.3.

New features in version 2.2

New features in version 2.1.1

New features in version 2.1

New features in version 2.0

Background

The Fedora Generic Search Service, abbreviated GSearch, is part of the Fedora Service Framework.

GSearch was developed by Gert Schmeltz Pedersen at the Technical University of Denmark, with feedback and contributions from members of the Fedora community, including Adam Soroka, Alfred Heller, Alistair Young, Beth Kirschner, Bill Brannan, Binaya Poudyal, Blake Anderson, Boon Low, Chris Wilper, Christian Orthmann, Christian Tønsberg, Dong Hua, Eric Brown, Eric James, Jonathan Green, Jun Yamog, Junran Lei, Lasse Aagren, Leire Urcelay, Luis Zorita, Mark Hall, Matt Zumwalt, Matthias Razum, Michael Appleby, Michael Hoppe, Morten Sørensen, Nikolai Schwertner, Nilani Ganeshwaran, Patrick Monbaron, Pierre-Yves Landron, Ranju Upadhyaya, Robert Sherratt, Roel de Cock, Ryan E. Scherle, Sam Liberman, Scott Hammel, Serhiy Polyakov, Shunde Zhang, Simon Lamb, Stephen Bayliss, Steve DiDomenico, Stuart Chalk, Swithun Crowe, Thierry Michel, and Xinjian Guo.

The work is funded by DEFF, Denmark's Electronic Research Library.