Errors when attempting to use conditional

13 views
Skip to first unread message

Michael Levy

unread,
Sep 2, 2020, 12:04:59 PM9/2/20
to solrmarc-tech
I have a need that could be met using a SolrMarc conditional. I'd like to grab a couple characters from the leader (and probably map them), but only if the 852$b contains a certain string value. Everything I've tried so far results in errors.

Here's the documentation on the "new" index specification language.

Here's an attempt:
foo  = 000[6] ? ( 852b = 'ebook' )

Which results in these errors:

ERROR [main] (IndexDriver.java:178) - Error processing index configurations: index.properties
ERROR [main] (IndexDriver.java:476) - foo =  { 000[6] } ? ( 852b = 'ebook' )
ERROR [main] (IndexDriver.java:478) - foo : Syntax error at input symbol "EQU" following symbol FIELDSPEC (with value of : 852 )
ERROR [main] (IndexDriver.java:476) - foo =  { 000[6] } ? ( 852b = 'ebook' )
ERROR [main] (IndexDriver.java:478) - foo : instead expected token classes are [POSITION]
ERROR [main] (IndexDriver.java:476) - foo =  { 000[6] } ? ( 852b = 'ebook' )

Just trying things out: these two (nonsensical) lines cause no error:
foo  = 000[6] ? ( 006[6] = 'x' )
foo  = 000[6] ? ( 006[6-7] = 'x' )

These cause errors. I haven't found any way to get the 852 in the conditional without errors:
foo  = 000[6] ? ( 852b = 'x' )
foo  = 000[6] ? ( 852 = 'x' )
foo  = 000[6] ? ( 852 matches 'x' )

Also this causes an error. This example would work if I have a single character instead of two characters in single quotes:
foo  = 000[6] ? ( 006[6-7] = 'xx' )

Thanks in advance!

Demian Katz

unread,
Sep 2, 2020, 12:24:17 PM9/2/20
to solrma...@googlegroups.com

Michael,

 

Could you share a sample record that contains the relevant condition? That might help with testing/troubleshooting.

 

Also, I should note that Bob has been unavailable for the past few months, but if he’s still away from the office, I’ll do what I can to help from my end (though I confess I don’t have an intimate knowledge of the rule processing logic; this might be a good excuse to study it more closely).

 

thanks,

Demian

--
You received this message because you are subscribed to the Google Groups "solrmarc-tech" group.
To unsubscribe from this group and stop receiving emails from it, send an email to solrmarc-tec...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/solrmarc-tech/65759e7f-c520-4f92-bae3-0aa66111d5a0n%40googlegroups.com.

Levy, Michael

unread,
Sep 2, 2020, 3:28:31 PM9/2/20
to solrma...@googlegroups.com
Attached is a small binary MARC file. I'll also send it to you directly, Demian, just in Google Groups doesn't allow attachments.

Because the error seems to come at the time that index.properties is being parsed, the error may not have anything to do with the MARC file that is being submitted.



TinyTest.mrc

Demian Katz

unread,
Sep 2, 2020, 3:29:45 PM9/2/20
to solrma...@googlegroups.com

Thanks, Michael, I’ll see what I can figure out, if anything, and will report back after I’ve done some experimentation. I agree that the problem may be occurring before the MARC is even getting accessed… but I just thought it would be helpful to have some real data, so if I can find a working solution, I’ll know that I actually did it right. 😊

 

- Demian

Levy, Michael

unread,
Sep 2, 2020, 3:52:17 PM9/2/20
to solrma...@googlegroups.com
Much appreciated, Demian. If this would require fairly deep work in SolrMarc, it may be easier for me to make a Beanshell or something like that to do what we want now, and expand SolrMarc later on if this kind of thing is a feature that is wanted by others.

Demian Katz

unread,
Sep 2, 2020, 4:20:25 PM9/2/20
to solrma...@googlegroups.com

I think I got it to work – the syntax is a bit unintuitive, and I had to dig into the language definitions (https://github.com/solrmarc/solrmarc/blob/fa2067958232e468bbefdf601470383ea2867ca6/src/org/solrmarc/index/indexer/FullScanner.lex) to figure it out. Try this:

 

foo= 000[6]?(852 $b matches "ebook")

 

If you have time, it might not be a terrible idea to add this as another example to the wiki page, since it may be useful for future reference. 😊

Levy, Michael

unread,
Sep 2, 2020, 4:28:02 PM9/2/20
to solrma...@googlegroups.com
Wow that is great, Demian! Thank you very much! I took a few stabs at similar patterns but not quite that one.

How would I edit the wiki? Do I clone the project and then issue a PR, or is there another way to do it?

Demian Katz

unread,
Sep 2, 2020, 4:30:08 PM9/2/20
to solrma...@googlegroups.com

Michael,

 

When I’m logged into GitHub, I just get an “edit” button when I’m looking at wiki pages. If you’re not seeing the same thing, it’s possible that I have a higher level of access than you do. If that’s the case, it looks like you may be able to use the “clone this wiki locally” button and then open a pull request, which I can presumably approve. If that’s too much of a headache, let me know and I can probably find time to do it myself later in the week. 😊

Robert Haschart

unread,
Sep 14, 2020, 11:43:36 AM9/14/20
to solrma...@googlegroups.com
Demian,

Thanks for addressing this.   I have been back in the world of working for some time now.    Curiously though I didn't see these posts come through on my work email.  Perhaps because I turned on the gmail account associated with my google.com sign in.   It may have "helpfully" redirected googlegroups subscriptions.

I'll see if I can get the solrmarc  mail and marc4j mail   to once again send these emails to my work account.

-Bob Haschart

Levy, Michael

unread,
Sep 14, 2020, 12:52:30 PM9/14/20
to solrma...@googlegroups.com
This reminds me that I agreed to do some docs; I ought to be able to do a PR. Thanks again Demian and Bob!

Reply all
Reply to author
Forward
0 new messages