If you're able to use Solr 6 then you can use Streaming Expressions to
solve this. The docs for Streaming Expressions in Solr 6 can be found at
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61330338.

One option would be to use an intersect to find documents in both sets.

intersect(
  search(collection1, q="aaa:1 OR bbb:2", fl="xxx,yyy,outer_id",
sort="outer_id asc", qt="/export"),
  search(collection1, q="zzz:vvv", fl="inner_id", sort="inner_id asc",
qt="/export"),
  on="outer_id=inner_id"
)

This will give you all documents from the first query where there is a
matching document in the second query (where matching is defined as
outer_id=inner_id).

- Dennis

On Wed, May 11, 2016 at 4:34 PM, baggadonuts <johnpr...@hotmail.com> wrote:

> Refer to the following documentation: https://wiki.apache.org/solr/Join
>
> According to the documentation the SOLR equivalent of this SQL query:
>
>     SELECT xxx, yyy
>     FROM collection1
>     WHERE outer_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
>
> is this:
>
>     /solr/collection1/select ? fl=xxx,yyy & q={!join from=inner_id
> to=outer_id}zzz:vvv
>
> Basically the SQL equivalent of what I'd like to do is:
>
>     SELECT xxx, yyy
>     FROM collection1
>     WHERE (aaa = "1" OR bbb = "2")
>         AND outer_id IN (SELECT inner_id FROM collection1 where zzz =
> "vvv")
>
> Is it possible to do this query in SOLR?
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/How-to-self-join-a-collection-with-SOLR-and-have-another-condition-tp4276235.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to