Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use Solr subquery similar to rdbms subqueries?

I need to run a query in Solr that contains another query as terms of the main query!

Something like this in the RDBMS SQL:

select name from movie
where movie.writer in (
    select director from movie where producer = 'XXX'
)

Is there any way to do this is Solr?

like image 876
Nazanin Avatar asked Dec 15 '25 12:12

Nazanin


1 Answers

Solved.
This is possible using "join" in Solr.
Following is the solution for my answered example:

fl=name&  
q={!join from=writer to=director}+producer:XXX

Also a filter query can be added. This filter will affect the result of join and query.
Thanks to Ramzy.

like image 145
Nazanin Avatar answered Dec 19 '25 00:12

Nazanin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!