You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "Kunzman, Doug" <dk...@usgs.gov> on 2013/09/02 20:53:25 UTC

db-data-config.xml ?

Hi -

I'm new to Solr and am trying to combine a script:and & RegExTransformer in
a db-dataconfig.xml that is used to ingest data into Solr.  Can anyone be
of any help?

There is definitly a "comma" between my script:add , and addRegexTransfomer
lines.

Any help would be appreciated.

My db-data-config.xml looks like this?
<dataConfig>
  <dataSource type="JdbcDataSource" driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:/test?netTimeoutForStreamingResults=240000000"
autoReconnect="true" user="postgres" password="" batchSize ="100000"
responseBuffering="adaptive"/>
<script><![CDATA[
                function add(row)        {
    var latlon_s= row.get('longitude')+','+row.get('latitude');
    var provider = row.get('provider');
                    var pointPath = '/'+
row.get('longitude')+','+row.get('latitude')+'/'+row.get('basis_of_record');
                    if ('NatureServe'.equalsIgnoreCase(provider) || 'USDA
PLANTS'.equalsIgnoreCase(provider)) {
                         pointPath += '/centroid';
                     }
                    row.put('latlon_s', latlon_s);
    row.put('pointPath_s',pointPath);
    var provider_id = row.get('provider_id');
var resource_id = row.get('resource_id_s');
var hierarchy = row.get('hierarchy_string');
row.put('hierarchy_homonym_string', '-' + hierarchy + '-');
row.put('BISONResourceID', '/' + provider_id + '/' + resource_id +'/');
                    return row;
                }
        ]]></script>

<document name="itis_to_portal.occurence">
         <!--entity name="occurrence"  pk="id" transformer="script:add"
query="select id, scientific_name, latitude, longitude, year,
basis_of_record, provider_id,resource_id_s, occurrence_date,  tsns,
 parent_tsn, hierarchy_string, collector, ambiguous, statecomputedfips,
countycomputedfips from itis_to_portal.solr" transformer="RegexTransformer"
-->
 <entity name="occurrence"  pk="id" query="select id, scientific_name,
latitude, longitude, year, basis_of_record, provider_id,resource_id_s,
occurrence_date,  tsns,  parent_tsn, hierarchy_string, collector,
ambiguous, statecomputedfips, countycomputedfips from itis_to_portal.solr"
transformer="RegexTransformer,script:add" >

and at runtime import I'm getting the following error message,
SEVERE: Full Import failed:java.lang.RuntimeException:
java.lang.RuntimeException:
org.apache.solr.handler.dataimport.DataImportHandlerException: Could not
invoke method :addRegexTransformer

Thanks,
Doug

Re: db-data-config.xml ?

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Did you find any other exceptions in the logs?

When I pasted the script section of your data config into my test
setup, I got an error saying that there is an unclosed string literal
in line 6

On Tue, Sep 3, 2013 at 12:23 AM, Kunzman, Doug <dk...@usgs.gov> wrote:
> Hi -
>
> I'm new to Solr and am trying to combine a script:and & RegExTransformer in
> a db-dataconfig.xml that is used to ingest data into Solr.  Can anyone be
> of any help?
>
> There is definitly a "comma" between my script:add , and addRegexTransfomer
> lines.
>
> Any help would be appreciated.
>
> My db-data-config.xml looks like this?
> <dataConfig>
>   <dataSource type="JdbcDataSource" driver="org.postgresql.Driver"
> url="jdbc:postgresql://localhost:/test?netTimeoutForStreamingResults=240000000"
> autoReconnect="true" user="postgres" password="" batchSize ="100000"
> responseBuffering="adaptive"/>
> <script><![CDATA[
>                 function add(row)        {
>     var latlon_s= row.get('longitude')+','+row.get('latitude');
>     var provider = row.get('provider');
>                     var pointPath = '/'+
> row.get('longitude')+','+row.get('latitude')+'/'+row.get('basis_of_record');
>                     if ('NatureServe'.equalsIgnoreCase(provider) || 'USDA
> PLANTS'.equalsIgnoreCase(provider)) {
>                          pointPath += '/centroid';
>                      }
>                     row.put('latlon_s', latlon_s);
>     row.put('pointPath_s',pointPath);
>     var provider_id = row.get('provider_id');
> var resource_id = row.get('resource_id_s');
> var hierarchy = row.get('hierarchy_string');
> row.put('hierarchy_homonym_string', '-' + hierarchy + '-');
> row.put('BISONResourceID', '/' + provider_id + '/' + resource_id +'/');
>                     return row;
>                 }
>         ]]></script>
>
> <document name="itis_to_portal.occurence">
>          <!--entity name="occurrence"  pk="id" transformer="script:add"
> query="select id, scientific_name, latitude, longitude, year,
> basis_of_record, provider_id,resource_id_s, occurrence_date,  tsns,
>  parent_tsn, hierarchy_string, collector, ambiguous, statecomputedfips,
> countycomputedfips from itis_to_portal.solr" transformer="RegexTransformer"
> -->
>  <entity name="occurrence"  pk="id" query="select id, scientific_name,
> latitude, longitude, year, basis_of_record, provider_id,resource_id_s,
> occurrence_date,  tsns,  parent_tsn, hierarchy_string, collector,
> ambiguous, statecomputedfips, countycomputedfips from itis_to_portal.solr"
> transformer="RegexTransformer,script:add" >
>
> and at runtime import I'm getting the following error message,
> SEVERE: Full Import failed:java.lang.RuntimeException:
> java.lang.RuntimeException:
> org.apache.solr.handler.dataimport.DataImportHandlerException: Could not
> invoke method :addRegexTransformer
>
> Thanks,
> Doug



-- 
Regards,
Shalin Shekhar Mangar.