Redlink Solr Plugin

Introduction

Screencast - Introducing the Redlink Solr Plugin The Redlink Solr Plugin allows the enhance your current search build with Apache Solr. The plugins allows enhancement via the Redlink API of data during Solr updates. The enhancements are stored in configurable fields.

For a quick introduction, please check the announcement post or watch this screencast where we introduce you the plugin, telling how you can use it to enhance your current Solr search with Redlink:

If you have any question, please contact us to get support.

Installation

The installation of the plugin is quite simple:

  1. Create lib directory for your core.
  2. Enable it by adding <lib dir="./lib" /> to the solrconfig.xml file.
  3. Copy the plugin (solr-plugin-1.0.0.jar) into the lib directory of the core where you want to use it.

The plugin has been tested with Apache Solr 4.6.1 and 4.3.1, but it should be compatible with versions >=4.3.0.

If you have problems on startup, it may be caused by a wrong logger configuration, at the wiki you have information about how to solve it.

Enhancer Configuration

  1. Create input and output fields in your schema.xml file.
  2. Enable component in solrconfig.xml by adding something like this:
    <updateRequestProcessorChain name="redlinkChain" default="true">
    
        <processor class="redlink.EnhancerProcessorFactory" >
    
            <!-- redlink.key MUST be defined -->
            <str name="redlink.key">YOUR_API_KEY</str>
    
            <!-- redlink.analysis MUST be defined with you app name encoded -->
            <str name="redlink.analysis">test-app</str>
    
            <!-- redlink.input CAN be set, default is 'input_field' -->
            <str name="redlink.input">my_input_field</str>
    
            <!-- redlink.output CAN be set, default is 'output_field'; can be String or Array -->
            <str name="redlink.output">my_output_field</str>
    
        </processor>
    
        <processor class="solr.LogUpdateProcessorFactory" />
        <processor class="solr.RunUpdateProcessorFactory" />
    
    </updateRequestProcessorChain>
    
    <requestHandler name="/update" class="solr.UpdateRequestHandler">
        <lst name="defaults">
            <str name="update.chain">redlinkChain</str>
        </lst>
    </requestHandler>
  3. In case you need a more custom enhancements handling, you can configure the redlink.output field with more detail by replacing the simple configuration shown above:
    <updateRequestProcessorChain name="redlinkChain" default="true">
    
        <processor class="redlink.EnhancerProcessorFactory" >
    
            (...)
    
            <!-- prefixes CAN be set; useful ti simplify path descriptions and type constraints -->
            <lst name="redlink.prefixes">
                <str name="skos">http://www.w3.org/2004/02/skos/core#</str>
                <str name="dct">http://purl.org/dc/terms/</str>
            </lst>
    
    
            <!-- redlink.outputs CAN be set; the arr defines more then one output fields -->
            <arr name="redlink.output">
                <!-- name of an output filed, the value is evaluated via LDPath from a specific dataset -->
                <lst>
                    <!-- MUST be set -->
                    <str name="redlink.field">my_output_field_de</str>
    
                    <!-- type CAN be set; enhancement result must than match the type; if not set, all types are accepted; -->
                    <!-- defined prefixes can be used as usual -->
                    <str name="redlink.type">skos:Concept</str>
    
                    <!-- path CAN be set; by default it uses first match of rdfs:label, dct:title, skos:prefLabel, foaf:name; -->
                    <!-- defined prefixes can be used as usual -->
                    <str name="redlink.path">skos:prefLabel[@de]</str>
    
                    <!-- dataset CAN be defined,; by default, the path is issues against all datasets in the app -->
                    <!--<str name="redlink.dataset">test-data</str>-->
                </lst>
                <lst>
                    <str name="redlink.field">my_output_field_en</str>
                    <str name="redlink.path">&lt;http://www.w3.org/2004/02/skos/core#prefLabel&gt;[@en]</str>
                </lst>
            </arr>
    
        </processor>
    
        (...)
    
    </requestHandler>

Once you have enabled and configured the plugin, you do not need to change how you are indexing your documents with Solr. The plugin will automatically enhance every document updated according the configuration you had specified.

Facet Recommender Configuration

  1. Create facet fields in schema.xml.
  2. Create a copy field with all facet fields (test in our example).
  3. Use the suggestion component in solrconfig.xml like this:
    <requestHandler name="/recommender" class="redlink.FacetRecommendationHandler" default="true">
        <!-- default values for query parameters can be specified, these
             will be overridden by parameters in the request
          -->
        <lst name="defaults">
    
            <!-- the field where all the facets has been copied to -->
            <str name="df">text</str>
    
            <!-- the fields that should be considered for recommendation -->
            <str name="redlink.field">facet1</str>
            <str name="redlink.field">facet2</str>
    
            <!-- fq is supported (e.g. this is important on query time,
                    if facets already are selected) -->
            <str name="fq">field3:"value"</str>
    
            <!-- limit per facet field -->
            <str name="redlink.limit">3</str>
    
        <!-- (OPTIONAL) if spellchecking should be used -->
        </lst>
        <arr name="first-components">
            <str>spellcheck</str>
        </arr>
    </requestHandler>
    
    <!-- of course it makes sense to use the copy field for spellchecking -->
    <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
        <str name="queryAnalyzerFieldType">textSpell</str>
        <lst name="spellchecker">
            <str name="name">text</str>
            <str name="field">text</str>
            <str name="spellcheckIndexDir">spellchecker</str>
            <str name="buildOnCommit">true</str>
        </lst>
    </searchComponent>
  4. Issue a query like /recommender?q=Re&redlink.limit=10. You can override the definitions of solrconfi.xml at query time.
  5. Get response like this:
    <?xml version="1.0"?>
    <response>
        <lst name="responseHeader">
            <int name="status">0</int>
            <int name="QTime">23</int>
        </lst>
        <lst name="recommendation">
            <int name="count">3</int>
            <lst name="facets">
                <lst name="facet1">
                    <int name="Redlink GmbH">1</int>
                    <int name="Salzburg Research">1</int>
                </lst>
                <lst name="facet2">
                    <int name="Ile de RĂ© Tourisme">1</int>
                </lst>
            </lst>
        </lst>
    </response>

Support

For whatever other question related with the plugin, please contact us.