I used the Solr 3.3 version as a Data Import Handler (DIH) with Oracle . His work is wonderful for me.
Now I am trying to do the same with Mysql . With the database change, I changed the query used in data-config.xml for MySql .
There are variables in the request that are passed to http. The same thing works fine in Oracle with variable resolution, but not in MySql .
Request:
SELECT DISTINCT doc.document_id , doc.first_version_id, doc.acl_id, fol.folder_id FROM ds_document_c doc, ds_folder fol WHERE doc.cabinet_id = ${dataimporter.request.cabinetId} AND fol.folder_id = doc.document_folder_id AND doc.index_state_modification_date >= to_date('${dataimporter.request.lastIndexDate}', 'DD/MM/YYYY HH24:MI:SS')
and Url:
localhost:8983/solr/dataimport?command=full-import&clean=true&commit=true&cabinetId=17083360&lastIndexDate='24/05/2015 00:00:00'
Solr builds the query as shown below:
SELECT DISTINCT doc.document_id , doc.first_version_id, doc.acl_id, fol.folder_id FROM ds_document_c doc, ds_folder fol WHERE doc.cabinet_id = 24 AND fol.folder_id = doc.document_folder_id AND doc.index_state_modification_date >= to_date('[?, '28/05/2015 11:13:50']', 'DD/MM/YYYY HH24:MI:SS')
I cannot understand why our date variable is not corrected properly in this case.
Due to_date('[?, '28/05/2015 11:13:50']' there is no correct MySql syntax, I get a MySql syntax error.
I get the following error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[?, '28/05/2015 11:13:50'], 'DD/MM/YYYY HH24:MI:SS')))' at line 1
Does anyone know where the problem is? Why is the resolver variable not working properly?
Note: to_date is a function that we wrote in MySql.