Hello,
Quick question about pattern maps: I want to change a small set of values in a field, while maintaining all the remaining values. I thought I could use a pattern map to match the things I want to rewrite, and then let everything else through by default… but the problem is that I end up duplicating the unwanted values in addition to rewriting them.
Here’s my configuration:
topic = custom, getAllSubfields(600:610:611:630:650:653:656, " "), (pattern_map.aliens)
pattern_map.aliens.pattern_0 = ^Alien criminal(.*)=>Noncitizen criminal$1
pattern_map.aliens.pattern_1 = ^Alien detention centers(.*)=>Detention centers$1
pattern_map.aliens.pattern_2 = ^Alien labor(.*)=>Noncitizen labor$1
pattern_map.aliens.pattern_3 = ^Alien property(.*)=>Foreign-owned property$1
pattern_map.aliens.pattern_4 = ^Aliens(.*)=>Noncitizens$1
pattern_map.aliens.pattern_5 = ^Children of alien laborers(.*)=>Children of noncitizen laborers$1
pattern_map.aliens.pattern_6 = ^Illegal alien children(.*)=>Children of undocumented immigrants$1
pattern_map.aliens.pattern_7 = ^Illegal aliens(.*)=>Undocumented immigrants$1
pattern_map.aliens.pattern_8 = (.*)=>$1
Is there a way to only apply pattern_8 when there has been no match in the preceding 7 patterns?
thanks,
Demian
Thanks, Bob, I think this is exactly what I need! I’ve edited the documentation to include this information, since I’m sure it will be helpful to others:
https://github.com/solrmarc/solrmarc/wiki/Translation-maps
I wasn’t entirely clear on the purpose of filter (or at least, in how it differs from default behavior), so please feel free to improve upon my wording there if you can… but for now I assume something vague is better than nothing at all. 😊
- Demian
To view this discussion on the web visit https://groups.google.com/d/msgid/solrmarc-tech/BN7PR13MB2417A4D398D0385B767A642880B70%40BN7PR13MB2417.namprd13.prod.outlook.com.
…and maybe I spoke too soon, because I’m seeing some weird behavior. I’m using this configuration:
topic_facet = 600x:610x:611x:630x:648x:650a:650x:651x:655x, (pattern_map.aliens)
topic = custom, getAllSubfields(600:610:611:630:650:653:656, " "), (pattern_map.aliens)
pattern_map.aliens.pattern_0 = ^Alien criminal(.*)=>Noncitizen criminal$1
pattern_map.aliens.pattern_1 = ^Alien detention centers(.*)=>Detention centers$1
pattern_map.aliens.pattern_2 = ^Alien labor(.*)=>Noncitizen labor$1
pattern_map.aliens.pattern_3 = ^Alien property(.*)=>Foreign-owned property$1
pattern_map.aliens.pattern_4 = ^Aliens(.*)=>Noncitizens$1
pattern_map.aliens.pattern_5 = ^Children of alien laborers(.*)=>Children of noncitizen laborers$1
pattern_map.aliens.pattern_6 = ^Illegal alien children(.*)=>Children of undocumented immigrants$1
pattern_map.aliens.pattern_7 = ^Illegal aliens(.*)=>Undocumented immigrants$1
pattern_map.aliens.pattern_8 = keepRaw
with the attached MARC record. Everything seems to be working as expected for the topic_facet field, but the topic field is still dropping the fake “Zarklovian electric eels” subject heading I added for testing purposes. The only difference between topic and topic_facet is that one is a text field and one is a string field, but I don’t think that matters from SolrMarc’s perspective. I tried cloning the pattern map with a different name and using separate ones for each field in case that made a difference (but it didn’t). Any idea what might be going on here?
If you don’t have time to delve into this right now, I can do some deeper digging of my own – just checking to see if you have a quick idea!
- Demian
To view this discussion on the web visit https://groups.google.com/d/msgid/solrmarc-tech/BN6PR03MB259591B2025AFEF941B7BC6AE8B60%40BN6PR03MB2595.namprd03.prod.outlook.com.
Thanks, Bob, that’s extremely helpful! I appreciate the in-depth explanation and the suggested workaround. This should definitely keep me in business for now.
- Demian
President, Zarklovian Electric Eel Preservation Society
To view this discussion on the web visit https://groups.google.com/d/msgid/solrmarc-tech/BN7PR13MB2417A5127B88DDFFB3D7B0F780B10%40BN7PR13MB2417.namprd13.prod.outlook.com.