oracle - Solr date variable resolver is not working with MySql -
i have used solr 3.3 version data import handler(dih) oracle. working fine me.
now trying same mysql. change in database, have changed query used in data-config.xml mysql.
the query has variables passed url in http. same thing works fine in oracle variable resolver not in mysql.
the query :
select distinct doc.document_id , doc.first_version_id, doc.acl_id, fol.folder_id ds_document_c doc, ds_folder fol doc.cabinet_id = ${dataimporter.request.cabinetid} , fol.folder_id = doc.document_folder_id , 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 building query below :
select distinct doc.document_id , doc.first_version_id, doc.acl_id, fol.folder_id ds_document_c doc, ds_folder fol doc.cabinet_id = 24 , fol.folder_id = doc.document_folder_id , doc.index_state_modification_date >= to_date('[?, '28/05/2015 11:13:50']', 'dd/mm/yyyy hh24:mi:ss')
i not able figure our why date variable not resloved in case.
because of to_date('[?, '28/05/2015 11:13:50']'
not in proper mysql syntax, getting mysql syntax error.
i following error
you have error in sql syntax; check manual corresponds mysql server version right syntax use near '[?, '28/05/2015 11:13:50'], 'dd/mm/yyyy hh24:mi:ss')))' @ line 1
anyone knows problem? why variable resolver not working expected?
note : to_date function written in mysql.
i checked out source code solr , tried solve issue.
i had fix , working me.
the variable resolve in case of date somehow making array , appends
'[?, '28/05/2015 11:13:50']'.
in templatestring.java in method filltokens(variableresolver resolver) have added code removes part added date.
if (i < s.length) { if(s[i].startswith("[")){ string temp = s[i].replace("[?,", ""); temp = temp.replace("]", ""); sb.append(temp); }else{ sb.append(s[i]); } }
with change, variable resolver appends date '28/05/2015 11:13:50' , removed mysql syntax error.
(note : didn't had time analyse why date variable resolved array. have done temporary fix , solved issue.)
Comments
Post a Comment