lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arcadius Ahouansou <arcad...@menelic.com>
Subject Re: Replace NULL with 0 while Indexing
Date Sat, 12 Oct 2013 15:09:45 GMT
What about using COALESCE in SQL?

like:
select COALESCE(duration, 0) as duration from mytable



On 11 October 2013 22:02, keshari.prerna <keshari.prerna@gmail.com> wrote:

> Hello,
>
> One of my indexing field have NULL values and i want it to be replaces with
> 0 while indexing itself. So that when i search after indexing it gives me 0
> instead of NULL.
>
> This is my data-config.xml and duration is the field which has null values.
>
> <dataConfig>
>   <dataSource type="JdbcDataSource"
>               driver="com.mysql.jdbc.Driver"
>                url="jdbc:mysql://trdbadhoc/test_results"
>               responseBuffering="adaptive"
>               batchSize="-1"
>               user="results"
>               password="resultsloader"/>
>    <document>
>         <entity name="Test_Syndrome"
>         pk="id"
>       query="SELECT TS.id AS id, TET.type AS error_type, TS.syndrome AS
> syndrome, S.start_date, SE.session_id AS sessionid,
>         S.duration, TL.logfile, J.job_number AS job, cluster,
>         S.hostname, platform FROM Test_Syndrome AS TS
>         STRAIGHT_JOIN Session_Errors AS SE ON (SE.test_syndrome_id = TS.id)
>         STRAIGHT_JOIN Session AS S ON (S.id = SE.session_id)
>         STRAIGHT_JOIN Test_Run AS TR ON (TR.session_id = SE.session_id)
>         STRAIGHT_JOIN  Test_Log AS TL ON (TL.id = TR.test_log_id)
>         STRAIGHT_JOIN  Job AS J ON (J.id = TL.job_id)
>         STRAIGHT_JOIN  Cluster AS C ON (C.id = J.cluster_id)
>         STRAIGHT_JOIN  Platform ON (TR.platform_id = Platform.id)
>         STRAIGHT_JOIN Test_Error_Type TET ON (SE.test_error_type_id =
> TET.id)">
>
>       <Field column="id" name="id"/>
>        <Field column="error_type" name="error_type"/>
>        <Field column="syndrome" name="syndrome"/>
>        <Field column="sessionid" name="sessionid"/>
>        <Field column="duration" name="duration"/>
>        <Field column="logfile" name="logfile"/>
>        <Field column="job" name="job"/>
>         <Field column="cluster" name="cluster"/>
>        <Field column="hostname" name="hostname"/>
>        <Field column="platform" name="platform"/>
>
>     </entity>
>   </document>
> </dataConfig>
>
> Please help.
>
> Thanks & Regards,
> Prerna
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Replace-NULL-with-0-while-Indexing-tp4095059.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message