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?

Reply via email to