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 Cameron Hurst <wa...@z33k.com> on 2011/08/22 03:46:51 UTC
Solr Join with multiple query parameters
Hi all,
I am trying to use the Join feature in SOLR trunk with limited sucess. I
am able to make simple searches and get the returns of documents as
expected. A query such a follows works perfectly fine and as expected:
http://localhost:8983/solr/core0/select?q={!join%20from=matchset_id_ss%20to=id}*:*
I can then add parameters to this search and make the search as follows,
and it works fine.
http://localhost:8983/solr/core0/select?q={!join%20from=matchset_id_ss%20to=id}*:*&fq=status_s:completed
I get filtered results of documents that are completed. The issue I am
now trying to face is how do I filter the initial search of documents
based on multiple conditions and then get a list of documents through
the join. Here is the search I am trying to do:
http://localhost:8983/solr/core0/select?start=0&q=*:*&fq=status_i:1&rows=30&fq=team_id_i:1223
This search returns everything I want as expected, now I want to apply
the join statement. I have added in the join statement above to make the
new link in any place I can think of, but it seems that the join
statement is taking place before any of the other filters applied. The
issue becomes is that the returned documents mapped by the
matchset_id_ss do not have the field status_i or team_id_i, these only
exist on the initial documents I am searching.
Is there a way that I can apply multiple filters first, then complete
the join? And if that is possible, can I then add more filters after the
join?
Thanks for the help,
Cameron
Re: Solr Join with multiple query parameters
Posted by Chris Hostetter <ho...@fucit.org>.
: http://localhost:8983/solr/core0/select?q={!join%20from=matchset_id_ss%20to=id}*:*&fq=status_s:completed
:
: I get filtered results of documents that are completed. The issue I am now
: trying to face is how do I filter the initial search of documents based on
: multiple conditions and then get a list of documents through the join. Here is
...
: Is there a way that I can apply multiple filters first, then complete the
: join? And if that is possible, can I then add more filters after the join?
I'm not certian, but i believe what you need to do is formulate your
filters as part of the main sub query for the join (currently "*:*).
You can make it a little cleaner by using LocalParam variable refs, but
unfortunately LocalParams doesn't really have any syntax for refering to
multivalued params, and i don't think there's any way to do filter
queries.
So i think you would have to do soemthing like...
q={!join from=matchset_id_ss to=id v=$qq}
qq=+status_i:1 +team_id_i:1223
...and make the join query into your "filter" constraint on the join docs
It would be nice if we had a more genearl way to support something like...
param={!foo fq=filterA fq=filterB}main query
...where the query produced was automaticly constrained by filterA and
filterB (as if in a BooleanQuery) but those filter queries were cached
independently -- but i'm not sure off the top of my head how to implement
something like that.
-Hoss