You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Faire Mii <fa...@gmail.com> on 2009/12/14 14:34:17 UTC

preserve relational strucutre in solr?

  was able to import data through solr DIH.

in my db i have 3 tables:

threads: id tags: id thread_tag_map: thread_id, tag_id

i want to import the many2many relationship (which thread has which  
tags) to my solr index.

how should the query look like.

i have tried with following code without result:

<entity name="thread_tags"
         query="select * from threads, tags, thread_tag_map where  
thread_tag_map.thread_id = threads.id AND thread_tag_map.tag_id =  
tags.id">
</entity>

s this the right way to go?

i thought that with this query each document will consist of tread and  
all the tags related to it. and i could do a query to get the specific  
thread by tagname.


thanks!

Re: preserve relational strucutre in solr?

Posted by Alexey Serba <as...@gmail.com>.
http://wiki.apache.org/solr/DataImportHandler#Full_Import_Example

See full import example, it has 1-n and n-n relationships

On Mon, Dec 14, 2009 at 4:34 PM, Faire Mii <fa...@gmail.com> wrote:
>
>  was able to import data through solr DIH.
>
> in my db i have 3 tables:
>
> threads: id tags: id thread_tag_map: thread_id, tag_id
>
> i want to import the many2many relationship (which thread has which tags) to my solr index.
>
> how should the query look like.
>
> i have tried with following code without result:
>
> <entity name="thread_tags"
>        query="select * from threads, tags, thread_tag_map where thread_tag_map.thread_id = threads.id AND thread_tag_map.tag_id = tags.id">
> </entity>
>
> s this the right way to go?
>
> i thought that with this query each document will consist of tread and all the tags related to it. and i could do a query to get the specific thread by tagname.
>
>
> thanks!