Change concat(i.name,'|',ih.name,'|',i.id) to *cast(*concat(i.name,'|',
ih.name,'|',i.id)* as char)*

Cheers
Avlesh

On Sat, Oct 3, 2009 at 1:51 PM, Ade B <adrian.bro...@blueyonder.co.uk>wrote:

>
> Hi
>
> I am using the DIH to import data from a mySQL database. Everything was
> fine
> in that I could index the data, and search the index and return the correct
> results. However, I have just changed my database-config.xml file to add
> the
> primary key value of a table to a field composed of other values. For
> example in the entity definition below from the database-config.xml file, I
> have added changed
>
> concat(i.name,'|',ih.name) to concat(i.name,'|',ih.name,'|',i.id).
>
>
> <entity name="ingredient" query="select concat(i.name,'|',ih.name,'|',i.id
> )
> as name, concat(i.quantity,'|',ih.name,'|',i.id) as quantity,
> concat(i.unit,'|',ih.name,'|',i.id) as unit from ingredientheader ih,
> ingredient i where ih.id = i.ingredientHeader_id and
> ih.recipe_id='${recipe.id}'"
>                deltaQuery="select ih.recipe_id from ingredientheader ih,
> ingredient i
> where ih.lastModified > '${dataimporter.last_index_time}' or i.lastModified
> > '${dataimporter.last_index_time}'"
>                parentDeltaQuery="select id from recipe where id =
> '${ingredientheader.recipe_id}'">
>                <field name="ingredientName" column="name"/>
>                <field name="ingredientUnit" column="unit"/>
>                <field name="ingredientQuantity" column="quantity"/>
> </entity>
>
> The query runs correctly in MySQL and returns the correct data. I can still
> index the data without error, but the response now contains garbage for
> these fields.
>
> Example snippet of response is:
>
> <arr name="ingredientName">
> <str>[...@1f759bf</str>
> </arr>
> -
> <arr name="ingredientQuantity">
> <str>[...@2513d0</str>
> </arr>
> -
> <arr name="ingredientUnit">
> <str>[...@1a82c58</str>
> </arr>
>
> Note: I am using a nightly build of Solr 1.4 from 26/9/2009.
>
> Any ideas?
>
> Thanks
> Ade
>
> --
> View this message in context:
> http://www.nabble.com/Garbled-data-in-response---reading-from-mySQL-database-tp25726655p25726655.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>

Reply via email to