RE: [EXTERNAL] [VuFind-General] Indexing issue: How to define a default value in case the specified subfield is not found

6 views
Skip to first unread message

Demian Katz

unread,
Apr 21, 2022, 12:34:16 PM4/21/22
to Carloni, Massimiliano, vufind-...@lists.sourceforge.net, solrma...@googlegroups.com

Massimiliano,

 

I think the most obvious solution to your problem would be to write a custom Java routine to handle this case – then you can iterate through the 700 fields, combining $4 values when appropriate and generating blank placeholders when necessary. It ensures that you cover everything predictably and in the right order.

 

I realize that it might be more desirable to do this “natively” with the index specification language, but I’m not sure that it offers the specificity or behavior that you need.

 

If you need assistance with building the appropriate Java code, let me know and I can provide some tips.

 

I’m also copying the solrmarc-tech list into this reply in case anyone there has a better/different suggestion.

 

- Demian

 

From: Carloni, Massimiliano <Massimilia...@oeaw.ac.at>
Sent: Thursday, April 21, 2022 11:00 AM
To: vufind-...@lists.sourceforge.net
Subject: [EXTERNAL] [VuFind-General] Indexing issue: How to define a default value in case the specified subfield is not found

 

Hello everyone,

 

I am currently using this index specification for the field author2_role:

author2_role = 70044, roles.properties, join (" : ")

because I need to index MARC fields 700 where multiple subfields $4 are present (which, if I understand correctly, is not supported with the standard mapping).

 

In this way, from an original MARC record:

700 $a Arguillère, Stéphane $4 trl $4 wst

700 $a Mustermann, Max $4 trl

 

I get in Solr:

 

**author2**

Arguillère, Stéphane

Mustermann, Max

 

**author2_role**

trl : wst

trl

 

where each value of author2 corresponds to a value in author2_role, and multiple roles for the same author are concatenated in the same string.

 

However, there are instances of 700 where no $4 subfield is specified, so the number and order of values in author2 and author2_role will be mismatched. For example, from:

700 $a Arguillère, Stéphane $4 trl $4 wst

700 $a Smith, John

700 $a Mustermann, Max $4 trl

 

I get in Solr:

 

**author2**

Arguillère, Stéphane

Smith, John

Mustermann, Max

 

**author2_role**

trl : wst

trl

 

Therefore, my question would be: Is there a way to set a default value (like "no_role") in the index specification, to be used only in case no 700$4 subfield is found? Or create an empty Solr field for these cases (like with the “getRelatorsFilteredByRelator” method in the standard mapping)?

 

I am trying to have a result like the following:

 

**author2**

Arguillère, Stéphane

Smith, John

Mustermann, Max

 

**author2_role**

trl : wst

no_role (OR empty field)

trl

 

Thanks for your help!

 

Best,

Massimiliano

Demian Katz

unread,
Apr 25, 2022, 8:31:39 AM4/25/22
to Carloni, Massimiliano, vufind-...@lists.sourceforge.net, solrma...@googlegroups.com

That sounds like a sound approach. Thanks for sharing the implementation! If others are facing similar issues, we could certainly consider adjusting the default behavior.

 

- Demian

 

From: Carloni, Massimiliano <Massimilia...@oeaw.ac.at>
Sent: Sunday, April 24, 2022 11:20 AM
To: Demian Katz <demia...@villanova.edu>; vufind-...@lists.sourceforge.net
Cc: solrma...@googlegroups.com
Subject: Re: [EXTERNAL] [VuFind-General] Indexing issue: How to define a default value in case the specified subfield is not found

 

Demian,

 

Many thanks for your reply and for your help! Yes, I wanted to be sure that this could not be done with a native solution before proceeding to write the custom method in Java.

 

Mateusz Żółtak from my institute (ACDH-CH in Vienna) just wrote two Java helper methods that approach the problem in a slightly different way, by:

  1. repeating the name of the author/contributor in author2 as many times as a certain subfield is used – method getRepeated();
  2. inserting a default value in author2_role when the specified subfield is missing – method getSubfieldAtLeastOnce().

 

In case anybody is interested or would like to reuse these custom methods, here is the code (https://github.com/acdh-oeaw/AkSearchSolr/blob/main/java_helpers/Oeaw.java) and some basic documentation (https://github.com/acdh-oeaw/AkSearchSolr/blob/main/doc/marc700.md).

 

Thanks again!

 

Best,

Massimiliano

Reply all
Reply to author
Forward
0 new messages