Skip to content

Commit 7ef4ee3

Browse files
authored
Merge pull request #11135 from IQSS/11023-solr-schema-update
Format Solr schema.xml using update-fields.sh on Linux
2 parents fe5fcb8 + e6b5d42 commit 7ef4ee3

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

doc/sphinx-guides/source/admin/metadatacustomization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ a necessary re-index, but for your custom metadata you will need to keep track o
548548

549549
Please note also that if you are going to make a pull request updating ``conf/solr/schema.xml`` with fields you have
550550
added, you should first load all the custom metadata blocks in ``scripts/api/data/metadatablocks`` (including ones you
551-
don't care about) to create a complete list of fields. (This might change in the future.)
551+
don't care about) to create a complete list of fields. (This might change in the future.) Please see :ref:`update-solr-schema-dev` in the Developer Guide.
552552

553553
Reloading a Metadata Block
554554
--------------------------

doc/sphinx-guides/source/container/configbaker-image.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Scripts
5454
- Default script when running container without parameters. Lists available scripts and details about them.
5555
* - ``update-fields.sh``
5656
- Update a Solr ``schema.xml`` with a given list of metadata fields. See ``update-fields.sh -h`` for usage details
57-
and :ref:`update-solr-schema` for an example use case.
57+
and example use cases at :ref:`update-solr-schema` and :ref:`update-solr-schema-dev`.
5858

5959
Solr Template
6060
^^^^^^^^^^^^^

doc/sphinx-guides/source/developers/tips.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,24 @@ Solr
185185
186186
Once some Dataverse collections, datasets, and files have been created and indexed, you can experiment with searches directly from Solr at http://localhost:8983/solr/#/collection1/query and look at the JSON output of searches, such as this wildcard search: http://localhost:8983/solr/collection1/select?q=*%3A*&wt=json&indent=true . You can also get JSON output of static fields Solr knows about: http://localhost:8983/solr/collection1/schema/fields
187187

188-
You can simply double-click "start.jar" rather that running ``java -jar start.jar`` from the command line. Figuring out how to stop Solr after double-clicking it is an exercise for the reader.
188+
You can simply double-click "start.jar" rather than running ``java -jar start.jar`` from the command line. Figuring out how to stop Solr after double-clicking it is an exercise for the reader.
189+
190+
.. _update-solr-schema-dev:
191+
192+
Updating the Solr Schema (Developers)
193+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194+
195+
Both developers and sysadmins need to update the Solr schema from time to time. One difference is that developers will be committing changes to ``conf/solr/schema.xml`` in git. To prevent cross-platform differences in the git history, when running the ``update-fields.sh`` script, we ask all developers to run the script from within Docker. (See :doc:`/container/configbaker-image` for more on the image we'll use below.)
196+
197+
.. code-block::
198+
199+
curl http://localhost:8080/api/admin/index/solr/schema | docker run -i --rm -v ./docker-dev-volumes/solr/data:/var/solr gdcc/configbaker:unstable update-fields.sh /var/solr/data/collection1/conf/schema.xml
200+
201+
cp docker-dev-volumes/solr/data/data/collection1/conf/schema.xml conf/solr/schema.xml
202+
203+
At this point you can do a ``git diff`` and see if your changes make sense before committing.
204+
205+
Sysadmins are welcome to run ``update-fields.sh`` however they like. See :ref:`update-solr-schema` in the Admin Guide for details.
189206

190207
Git
191208
---

0 commit comments

Comments
 (0)