More object oriented results from Solr and nullable database -


lets assume have configuration:

data-import-handler-config.xml

<dataconfig>     <datasource type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="jdbc:mysql://127.0.0.1/solr" user="root" password="" batchsize="-1" />     <document>         <entity name="book" query="select id, title book;">             <field column="title" name="title" />             <entity name="author" query="select name, alias author id='${book.id}'">                 <field name="name" column="name" />                 <field name="alias" column="alias" />             </entity>         </entity>     </document> </dataconfig> 

schema.xml

<fields>     <field name="_version_" type="string" indexed="true" stored="true" multivalued="false" />     <!-- general -->     <field name="title" type="text_en" indexed="true" stored="true" multivalued="false" />     <field name="name" type="text_en" indexed="true" stored="true" multivalued="true" />     <field name="alias" type="boolean" indexed="true" stored="true" multivalued="true" /> </fields> 

result got solr (in xml format) looks this:

<doc>     <str name="title">book title</str>     <arr name="name">         <str>john doe 1</str>         <str>john doe 2</str>         <str>john doe 3</str>     </arr>     <arr name="alias">         <bool>false</str>         <bool>false</str>         <bool>true</str>     </arr> </doc> 

and there nothing wrong long fileds in database are not null.

when of alias set null, got instance:

<doc>     <str name="title">book title</str>     <arr name="name">         <str>john doe 1</str>         <str>john doe 2</str>         <str>john doe 3</str>     </arr>     <arr name="alias">         <bool>true</str>     </arr> </doc> 

however don't know alias of author set null.

1) possible keep nulls in database , import data solr without problem?

i think simpler data in little more "object oriented" format, this:

<doc>     <str name="title">book title</str>     <authors>         <author>             <str name="name">john doe 1</str>             <bool name="alias">false</bool>         </author>         <author>             <str name="name">john doe 2</str>             <bool name="alias">false</bool>         </author>         <author>             <str name="name">john doe 3</str>             <bool name="alias">true</bool>         </author>     <authors> </doc> 

2) can "object oriented" style achieved using custom solr field?


Comments