solrsubquerysolr-query-syntax

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?


Solution

  • 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.