From: Tod O. <to...@uc...> - 2012-11-21 18:10:28
|
You set indexer to null in line 5, which should explain the problem. Ran into something similar just yesterday. Try removing that line, as solrmarc seems to arrange for "indexer" to just be available. No need to define it. -Tod On Nov 21, 2012, at 11:11 AM, Zeno Tajoli <z.t...@ci...> wrote: > Hi to all, > > I'm try to develop a BeanShell to do specific change for indexing. > > The script is called in this way: > topic = script(subjBiella.bsh), getCatSquareSubj(650, " -- ") > > The BeanShell script: > > import org.marc4j.marc.Record; > import java.util.Iterator; > import java.util.Set; > > org.solrmarc.index.SolrIndexer indexer = null; > > public Set getCatSquareSubj(Record record, String getAllSpec, String > separator) { > Set<String> val = indexer.getAllSubfields(record, "650", " -- "); > if (val.isEmpty()) return(null); > Iterator iter = val.iterator(); > while (iter.hasNext()) > { > String value = (String)iter.next(); > value = value.replaceAll("[", ""); > value = value.replaceAll("]", ""); > return (value); > } > return null; > } > > But I receive an error: > > GRAVE: Unable to index record ANA0000585 (record count 1) -- Unable to > evaluate script: subjBiella.bsh > java.lang.IllegalArgumentException: Unable to evaluate script: > subjBiella.bsh > at > org.solrmarc.index.SolrIndexer.getInterpreterForScript(SolrIndexer.java:1264) > at > org.solrmarc.index.SolrIndexer.handleScript(SolrIndexer.java:1118) > at > org.solrmarc.index.SolrIndexer.addFieldValueToMap(SolrIndexer.java:914) > at org.solrmarc.index.SolrIndexer.map(SolrIndexer.java:821) > at org.solrmarc.marc.MarcImporter.addToIndex(MarcImporter.java:399) > at > org.solrmarc.marc.MarcImporter.importRecords(MarcImporter.java:313) > at org.solrmarc.marc.MarcImporter.handleAll(MarcImporter.java:607) > at org.solrmarc.marc.MarcImporter.main(MarcImporter.java:867) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at com.simontuffs.onejar.Boot.run(Boot.java:334) > at com.simontuffs.onejar.Boot.main(Boot.java:170) > Caused by: Parse error at line 8, column 21. Encountered: = > at bsh.Parser.generateParseException(Unknown Source) > at bsh.Parser.jj_consume_token(Unknown Source) > at bsh.Parser.Statement(Unknown Source) > at bsh.Parser.BlockStatement(Unknown Source) > at bsh.Parser.Block(Unknown Source) > at bsh.Parser.MethodDeclaration(Unknown Source) > at bsh.Parser.BlockStatement(Unknown Source) > at bsh.Parser.Line(Unknown Source) > at bsh.Interpreter.Line(Unknown Source) > at bsh.Interpreter.eval(Unknown Source) > at bsh.Interpreter.eval(Unknown Source) > at bsh.Interpreter.eval(Unknown Source) > at > org.solrmarc.index.SolrIndexer.getInterpreterForScript(SolrIndexer.java:1256) > ... 13 more > > The line n.8 of the script is: > > Set<String> val = indexer.getAllSubfields(record, "650", " -- "); > > In fact I'm very basic about BeanShell and java. > Is there any evident error ? > > Thank you very much for your help. > > Cheers > Zeno Tajoli > -- > Dott. Zeno Tajoli > Dipartimento CILEA > z.tajoliAT_SPAM_no_prendiATcineca.it > fax +39 02 2135520 > CINECA - Consorzio Interuniversitario > > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from $795 for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > _______________________________________________ > Vufind-tech mailing list > Vuf...@li... > https://lists.sourceforge.net/lists/listinfo/vufind-tech |