I have successfully written a custom function and hooked it into my Solr engine. However, I am having problems passing parameters into that function from within the data-import.xml import definition file.
I have tried to methods, one which passes in a field from the current entity query, and the other approach which tries to use a variable from the last query...no seem to work.
Attempt 1: Pass in columns from current query:
<entity name="doc" query="SELECT id, date, ${dataimporter.functions.myfunc(id,date)} AS custom_value FROM Documents" />
This doesn't work as id and date seem to be passed in as literals, not the column values.
Attempt 2:
<entity name="doc" query="SELECT id, date FROM Documents">
<entity name="special" query="SELECT ${dataimporter.functions.myfunc(${doc.id}, ${doc.date})} AS custom_value" >
<field name="custom_value" column="custom_value" />
</entity>
</entity>
This doesn't work because it gets confused from the variable within the variable.
Any suggestions on how to make this work?
Try
<entity name="doc" query="SELECT id, date, ${dataimporter.functions.myfunc(doc.id,doc.date)} AS custom_value FROM Documents" />