Skip to content

Commit 5d288c3

Browse files
authored
Merge pull request #11204 from IQSS/11004-docker-block-solr
how to load metadata blocks and adjust Solr in Docker
2 parents 7f992cb + f758b09 commit 5d288c3

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The tutorial on running Dataverse in Docker has been updated to include [how to load a metadata block](https://dataverse-guide--11204.org.readthedocs.build/en/11204/container/running/demo.html#additional-metadata-blocks) and then update Solr to know about the new fields. See also #11004 and #11204

doc/sphinx-guides/source/container/running/demo.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,54 @@ If you want to specify fewer previewers, you can edit the ``compose.yml`` file.
213213

214214
``INCLUDE_PREVIEWERS=text,html,pdf,csv``
215215

216+
217+
.. _additional-metadata-blocks:
218+
219+
Additional Metadata Blocks
220+
++++++++++++++++++++++++++
221+
222+
Metadata fields such as "Title" are part of a metadata block such as "Citation". See :ref:`metadata-references` in the User Guide for the metadata blocks that ship with Dataverse.
223+
224+
At a high level, we will be loading a metadata block and then adjusting our Solr config to know about it.
225+
226+
Care should be taken when adding additional metadata blocks. There is no way to `preview <https://github.com/IQSS/dataverse/issues/2551>`_ or `delete <https://github.com/IQSS/dataverse/issues/9628>`_ a metadata block so please use a throwaway environment.
227+
228+
:ref:`metadata-references` lists some experimental metadata blocks. In the example below, we'll use the CodeMeta block.
229+
230+
First, download a metadata block or create one by following :doc:`/admin/metadatacustomization` in the Admin Guide.
231+
232+
Load the metadata block like this:
233+
234+
``curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file codemeta.tsv``
235+
236+
Next, reconfigure Solr to know about the new metadata block.
237+
238+
You can back up your existing Solr schema like this:
239+
240+
``cp docker-dev-volumes/solr/data/data/collection1/conf/schema.xml docker-dev-volumes/solr/data/data/collection1/conf/schema.xml.orig``
241+
242+
You can see the existing fields Solr knows about like this:
243+
244+
``curl http://localhost:8983/solr/collection1/schema/fields``
245+
246+
Update your Solr schema with the following command:
247+
248+
``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``
249+
250+
Then, reload Solr:
251+
252+
``curl "http://localhost:8983/solr/admin/cores?action=RELOAD&core=collection1"``
253+
254+
You can get a diff of your old and new Solr schema like this:
255+
256+
``diff docker-dev-volumes/solr/data/data/collection1/conf/schema.xml.orig docker-dev-volumes/solr/data/data/collection1/conf/schema.xml``
257+
258+
You should be able to see the new fields from the metadata block you added in the following output:
259+
260+
``curl http://localhost:8983/solr/collection1/schema/fields``
261+
262+
At this point you can proceed with testing the metadata block in the Dataverse UI. First you'll need to enable it for a collection (see :ref:`general-information` in the User Guide section about collection). Afterwards, create a new dataset, save it, and then edit the metadata for that dataset. Your metadata block should appear.
263+
216264
Next Steps
217265
----------
218266

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ Both developers and sysadmins need to update the Solr schema from time to time.
202202
203203
At this point you can do a ``git diff`` and see if your changes make sense before committing.
204204

205-
Sysadmins are welcome to run ``update-fields.sh`` however they like. See :ref:`update-solr-schema` in the Admin Guide for details.
205+
Sysadmins are welcome to run ``update-fields.sh`` however they like. See :ref:`update-solr-schema` in the Admin Guide and :ref:`additional-metadata-blocks` in the Container Guide for details.
206206

207207
Git
208208
---

0 commit comments

Comments
 (0)