How to delete MARCXML records with solrmarc

11 views
Skip to first unread message

Be Fehl

unread,
May 26, 2021, 11:48:35 AM5/26/21
to solrmarc-tech

I am trying to delete records from solr by using a MARCXML file but solrmarc is not using my record-"id" for deleting the record with DeleteRecordIfFieldNotEmpty.

My delete.properties is:
solr.indexer.properties = marc_delete.properties
...

My marc_delete.properties is:
collection = "KatalogPlus"
institution = "Uni Bielefeld"
building = "Bibliothek"
id = custom, getAlmaId("(\(49HBZ_BIE\))(.*)"), DeleteRecordIfFielNotEmpty

My MARCXML has a record with
001 = 123456
035a = (49HBZ_BIE)987654

My custom function is taking the id from marc field 035a if the number starts with (49HBZ_BIE) which is our local system, else it should fallback and take the id from 001 which is the global system. The function works fine.

But if I ever want to delete the local record with id 987654 I have to do the same for deleting as for indexing. Otherwise deleting would  not work. Therefore I select the right "id" and call DeleteRecordIfFieldNotEmpty.
The solrmarc.log shows that deleting takes place, but it is not taking my "id" from field 035a, instead it is taking the global "id" from 001. This fails naturally because there is no record with id 123456 in the index.

From the logs:
INFO main.org.solrmarc.driver.ThreadedIndexer - Done writing records to solr
INFO main.org.solrmarc.driver.Indexer - Deleting 1 records
DEBUG main.org.solrmarc.driver.Indexer - Deleting record 123456
INFO main.org.solrmarc.driver.Indexer - Commiting updates to Solr

We can see that DeleteRecordIfFieldNotEmpty takes place but it is not using my "id", it is using the id from field 001.

Why this?

How can I change it to use my id?






Reply all
Reply to author
Forward
0 new messages