search over two independent tables

2010-10-14 Thread Anthony Maudry

 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 :


url="jdbc:postgresql://host/database" user="user" password="password" />












Note that the two entities are at the same level. Only the first entity 
("newsfeeds") will give results


I then tried this config :


url="jdbc:postgresql://host/database" user="user" password="password" />












As expected the results were crossed.

I wonder how I could implement the search over two independent tables?

Thanks for any answer.

Anthony


Re: search over two independent tables

2010-10-14 Thread Anthony Maudry

 Thanks for your quick answer.

Actually I need to get result from both tables from a single search.

I tried to define correctly every fields as you told me in your previous 
message but I only get result from one table (actualy "Newsfeeds")



Le 14/10/2010 11:49, Allistair Crossley a écrit :

actually your intention is unclear ... are you wanting to run a single search 
and get back results from BOTH newsfeed and message? or do you want one or the 
other? if you want one or the other you could use my strategy which is to store 
the entity type as a field when indexing, e.g.




note, if you don't have a foo column for type, make it up in your query, e.g. 
select n.*, 'Newsfeed' as type from ...

then for silo'd searches you would want to ensure a filter of type:Newsfeed. 
another handy thing is to facet.field=type and search (without a filter) as 
then you'll get back counts for your Newsfeed Message results too.




Re: search over two independent tables

2010-10-14 Thread Anthony Maudry

 Sorry for the late answer.

It works now thanks to you, Allistair.

I needed to use your "uid" field, common to the two entities but built 
in different ways.


here is the result in a sample of the data-config.xml file

...





...





...


...

uid is define as uniqueKey in the schema.xml file.

Thank you for your help