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 Sébastien Lorber <lo...@gmail.com> on 2012/11/15 15:02:31 UTC
DataImportHandler in Solr 1.4 bug?
Hello,
I don't know if this is a bug or a missing feature, nor if it was corrected
in new versions of Solr (can't find any JIRA about it), so I just want to
show you the problem...
I can't test with Solr 4.0, I have a legacy system, not a lot of time, not
a Solr expert at all and it seems just updating the maven dependencies and
fixing some deprecated conf is not enough...
I have a Parameters table which contains params as KEY / VALUE
(typically it is a Spring Batch job parameters table)
My schema has a dynamic field:
<dynamicField name="JOB_PARAM_*" type="string" indexed="true"
stored="true"/>
---------------------------------------------------------------------------------------------------
In the DIH, when I use:
<entity name="PARAM" query="SELECT key_name AS KEY, string_val AS
VALUE FROM BATCH_JOB_PARAMS WHERE JOB_INSTANCE_ID =
${JOB_EXEC.JOB_INSTANCE_ID}">
<field column="VALUE" name="JOB_PARAM_${PARAM.KEY}" />
</entity>
It seems the placeholder ${PARAM.KEY} is not replaced.
This leads me to a solr document where i have a field
- JOB_PARAM_=xxx (like if ${PARAM.KEY} = empty while it is never empty in
database)
Instead of having multiple fields (one per parameter):
- JOB_PARAM_p1=xxx
- JOB_PARAM_p2=yyy
- JOB_PARAM_p3=yyy
---------------------------------------------------------------------------------------------------
Curiously I wanted to test with a nested entity and by chance the
workaround works!
<entity name="PARAM" query="SELECT key_name AS KEY, string_val AS
VALUE FROM BATCH_JOB_PARAMS WHERE JOB_INSTANCE_ID =
${JOB_EXEC.JOB_INSTANCE_ID}">
<!-- Hack: obligé d'utiliser une sous requête inutile car sinon
Solr ne remplace pas le placeholder dans JOB_PARAM_${PARAM.KEY} -->
<entity name="bugHack" query="SELECT '${PARAM.VALUE}' AS VALUE FROM
DUAL">
<field column="VALUE" name="JOB_PARAM_${PARAM.KEY}" />
</entity>
</entity>
This time i get in my document what i wanted in the first place:
- JOB_PARAM_p1=xxx
- JOB_PARAM_p2=yyy
- JOB_PARAM_p3=yyy
I guess this is a bug, but perhaps it is already fixed in new versions?
Re: DataImportHandler in Solr 1.4 bug?
Posted by Andy Lester <an...@petdance.com>.
On Nov 15, 2012, at 8:02 AM, Sébastien Lorber <lo...@gmail.com> wrote:
> <entity name="PARAM" query="SELECT key_name AS KEY, string_val AS
> VALUE FROM BATCH_JOB_PARAMS WHERE JOB_INSTANCE_ID =
> ${JOB_EXEC.JOB_INSTANCE_ID}">
> <field column="VALUE" name="JOB_PARAM_${PARAM.KEY}" />
> </entity>
I don't know where you're getting the ${JOB_EXEC.JOB_INSTANCE_ID}. I believe that if you want to get parameters passed in, it looks like this:
WHERE batchid = ${dataimporter.request.batchid}
when I kick off the DIH like this:
$url/dih?command=full-import&entity=titles&commit=true&batchid=47
At least that's how it works for me in 3.6 and 4.0.
xoa
--
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance