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 "cmd.ares" <cm...@gmail.com> on 2013/05/30 04:34:13 UTC

multiple field join?

http://wiki.apache.org/solr/Join  
I found solr join is actually  sql subquery,does solr  support 3 tables jion
? the sql like this
SELECT xxx, yyy 
FROM collection1
WHERE 
outer_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
and 
outer_id2 IN (SELECT inner_id2 FROM collection1 where ttt = "xxx")
and 
outer_id3 IN (SELECT inner_id3 FROM collection1 where ppp = "rrr")

how to write the solr request url?
thanks.



--
View this message in context: http://lucene.472066.n3.nabble.com/multiple-field-join-tp4066930.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: multiple field join?

Posted by Chris Hostetter <ho...@fucit.org>.
: My advice. Forget joins and try to write this in pure
: Solr query language. The more you try to use Solr like
: a database, the more you'll get into trouble. De-normalize
: your data and try again.

with that important caveat in mind, it is worth noting that what you are 
essentailly asking about is using multiple filters each containing a 
distinct join query...

: > outer_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
: > and
: > outer_id2 IN (SELECT inner_id2 FROM collection1 where ttt = "xxx")
: > and
: > outer_id3 IN (SELECT inner_id3 FROM collection1 where ppp = "rrr")

	?q=*:*
	&fq={!join from=inner_id to=outer_id}zzz:vvv 
	&fq={!join from=inner_id2 to=outer_id2}ttt:xxx 
	&fq={!join from=inner_id3 to=outer_id3}ppp:rrr 


-Hoss

Re: multiple field join?

Posted by Erick Erickson <er...@gmail.com>.
Solr Join is _not_ sql subquery and won't work like one.
There's a reason it's called "pseudo join" in the JIRA issues.

My advice. Forget joins and try to write this in pure
Solr query language. The more you try to use Solr like
a database, the more you'll get into trouble. De-normalize
your data and try again.


Best
Erick

On Wed, May 29, 2013 at 10:34 PM, cmd.ares <cm...@gmail.com> wrote:
> http://wiki.apache.org/solr/Join
> I found solr join is actually  sql subquery,does solr  support 3 tables jion
> ? the sql like this
> SELECT xxx, yyy
> FROM collection1
> WHERE
> outer_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
> and
> outer_id2 IN (SELECT inner_id2 FROM collection1 where ttt = "xxx")
> and
> outer_id3 IN (SELECT inner_id3 FROM collection1 where ppp = "rrr")
>
> how to write the solr request url?
> thanks.
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/multiple-field-join-tp4066930.html
> Sent from the Solr - User mailing list archive at Nabble.com.