Martini Creating a Core on Solr
This guide outlines the process of creating and linking a local or remote Solr core (collection) with Martini. The procedure involves configuring both your Solr server and Martini to establish a successful connection.
Prerequisites
Before proceeding, ensure familiarity with:
- Configuring solrconfig.xml
- Documents, fields, and schema design in Solr
- Defining core.properties in Solr
Procedure
1. Configure Martini Instance Properties
Set the necessary solr-prefixed properties in Martini:
solr.mode: Determines where Martini looks for the Solr core. Options include:local: For an embedded Solr instance using the host's filesystem.remote: To connect to a remote Solr instance.cloud: For a SolrCloud instance.
2. Create the Solr Core or Collection
Local Mode
-
Structure your configuration files (
solrconfig.xml,schema.xml,core.properties) as follows:1 2 3 4 5
<core_name> ├── conf │ ├── schema.xml │ ├── solrconfig.xml │ └── core.properties -
Place the directory under
<package>/solrin your project.
Remote Mode
- Structure your configuration files similarly, without
core.properties. - Add the core configuration folder to
<solr-home>/server/solr. - Use the Solr admin page to add the new core.
Cloud Mode
- Zip
solrconfig.xmlandschema.xml. - Upload the zip as a ConfigSet using the ConfigSets API.
- Use the Solr admin page to add the new collection.
3. Register the Core in Martini
Edit the package.xml of the relevant Martini package to include your new Solr core:
1 2 3 4 5 6 7 | |
4. Restart Martini
Restart your Martini instance or the affected package, depending on the scope of changes.
Confirmation
Successful registration will be indicated in the log messages:
1 2 | |