# Solr

The Solr plugin provides functionality relating to the Apache Solr search engine.

# Dependency Information

<dependency>
  <groupId>com.k-int.rosetta</groupId>
  <artifactId>rosetta-plugin-solr</artifactId>
  <version>3.0.0</version>
</dependency>

# Providers

# solr

The solr Provider allows Rosetta to communicate with a Solr index. It accepts a GenericSearchRequest whose fields are interpreted as follows in order to form the Solr query:

  • ids: For each item in the ids array and each entry in the Provider property search_config.id_fields, a field sub-query of the form {id_field}:{id_value}^{id_boost} is constructed where id_field and id_boost are the key and value of the search_config.id_fields entry, respectively, and id_value is the item of the ids array.

    The sub-queries are then combined into the root query (along with those generated by the queries request parameter) using Boolean OR operations between each field sub-query.

  • queries: For each item in the queries array and each entry in the Provider property search_config.search_fields, a field sub-query of the form {field}:{query}^{boost} is constructed where field and boost are the key and value of the search_config.search_fields entry, respectively, and query is the item of the queries array.

    The sub-queries are then combined into the root query (along with those generated by the ids request parameter) using Boolean OR operations between each field sub-query.

Facet fields can be populated using the search_config.facet_fields Provider property.

The Solr request is performed against the configured Solr instance and each result is registered as a separate result in the provider response, and any facet fields are used to populate the aggregations provider field as an array of Aggregation objects.

# Properties

Property Type Default Description
protocol String http The protocol used to communicate with the Solr instance
host String localhost The host on which the Solr instance is running
port Integer 8983 The port on which the Solr instance is running
base_uri String solr The base path of the Solr API
core String main The name of the Solr core (index) to search against
client_timeout Integer 3000 The client timeout in milliseconds
request_timeout Integer 3000 The request timeout in milliseconds
search_config.id_fields Map<String, Float> { identifier: 0.0 } The fields used with the ids request parameter to generate id queries (See Solr Provider)
search_config.search_fields Map<String, Float> { summaryTitleText: 0.0 } The fields used with the queries request parameter to generate search queries (See Solr Provider)
search_config.facet_fields String[] [] The fields to be used for faceting

# Example

name: my-provider
type: solr
properties:
  protocol: http
  host: localhost
  port: 8983
  base_uri: solr
  core: main
  client_timeout: 3000
  request_timeout: 3000
  search_config:
    id_fields:
      identifier: 0.0
    search_fields:
      summaryTitleText: 0.0
    facet_fields:
      - data_type