results from both tables with 1 search - your first suggestion with separate 
entities under document is right, or at least how i do it. things that i have 
often found ...

0. check stdout for SQL errors
1. verify that your SQL works when you run it direct on your database!
2. verify that your search would definately match - choose a keyword only in a 
message, or index a type field as I mentioned and use the 
solr/select?q=type:Message strategy to see into the index whether anything is 
there to confirm
3. when you make changes to schema.xml or dataimport.xml make sure you restart 
solr and fully re-index your changes (this often caught me out)
4. are you checking this on a single server or do you have a stage and 
production server too (this caught me out sometimes)
5. make sure if you are setting your unique ID field with a unique field from 
each entity otherwise one will overwrite the other. I have 2 ID fields, one 
called id and one called uid. UID is my unique field and in each entity I 
prefix the row id with a letter, e.g. N1, M1. then i store the actual id (you 
need to generate it in the sql, e.g. select id, concat('N', cast(id as 
char(50)) as uid from ... to make life easier. 

allistair

On Oct 14, 2010, at 6:06 AM, Anthony Maudry wrote:

> 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.
>> 
>> <entity><field column="type" name="type_field" /></entity>
>> <entity><field column="type" name="type_field" /></entity>
>> 
>> 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.
> 

Reply via email to