your first example is correct <document> <entity name="newsfeed"></entity <entity name="message"></entity </document>
i have the same config for indexing 5 different tables what you don't have from what i can see is a field name mapped to each column, e.g. <field column="nf_text" /> i always have to provide the destination field in schema.xml, e.g. <field column="nf_text" name="the_field" /> On Oct 14, 2010, at 5:22 AM, Anthony Maudry wrote: > Hello, > > I'm using Solr with a postgreSQL database. I need to search across two tables > with no link between them. > > ie : I have got a "messages" table and a "newsfeeds" table, nothing liking > them. > > I tried to configure my data-config.xml to implement this but it seems that > tables can't be defined separately. > > The configuration I first tried was the following : > > <dataConfig> > <dataSource driver="org.postgresql.Driver" > url="jdbc:postgresql://host/database" user="user" password="password" /> > <document> > <entity name="newsfeeds" query="select id as nf_id, text as nf_text, url, > note from newsfeeds" > > <field column="nf_text" /> > </entity> > <entity name="messages" query="select id as m_id, body from messages" > > <field column="body" /> > </entity> > </document> > </dataConfig> > > Note that the two entities are at the same level. Only the first entity > ("newsfeeds") will give results > > I then tried this config : > > <dataConfig> > <dataSource driver="org.postgresql.Driver" > url="jdbc:postgresql://host/database" user="user" password="password" /> > <document> > <entity name="newsfeeds" query="select id as nf_id, text as nf_text, url, > note from newsfeeds" > > <field column="nf_text" /> > <entity name="messages" query="select id as m_id, body from messages" > > <field column="body" /> > </entity> > </entity> > </document> > </dataConfig> > > As expected the results were crossed. > > I wonder how I could implement the search over two independent tables? > > Thanks for any answer. > > Anthony