Hi,

I wonder if the function ${dataimporter.functions.escapeSql()} is available in 
Solr 5.3.1.

Whenever i use it in my data import handlers, Solr replaces 
'${dataimporter.functions.escapeSql(field)}' by '' (an empty string).

How can I escape strings when building sql queries in DIHconfigFile ?

I have 2 entities : ref_entity0 and ref_entity1.

If ref_entity0's name contains a simple quote ('), the following exception 
occurs : 
ref_entity1:org.apache.solr.handler.dataimport.DataImportHandlerException: 
Unable to execute query: select ...

Below an excerpt of the code.

<entity name="ref_entity0" onError="skip" dataSource="psql"

       query="select id, parent_name

                    from ref_entity

                    where ref_entity.id = 1">

      <field column="parent_name" name="parent_name" />

      <entity name="ref_entity1" onError="skip" dataSource="psql"

                    query="select id , 
concat(name,'§','$dataimporter.functions.escapeSql(ref_entity0.parent_name)}') 
as hierarchical_name
...

Thanks!

------ 
Joachim Dornbusch 
Direction des Systèmes d'Information 
AgroParisTech : 16, rue Claude Bernard 75005 Paris 


Reply via email to