On 4/8/2014 22:00 GMT Shawn Heisey wrote:
>On 4/8/2014 1:48 PM, Mark Olsen wrote:
>> Solr version 4.2.1
>>
>> I'm having an issue using a "join" query with a range query, but only when 
>> the query
is wrapped in parens.
>>
>> This query works:
>>
>> {!join from=member_profile_doc_id to=id}language_proficiency_id_number:[30 
>> TO 50]
>>
>> However this query does not (just wrapping with parens):
>>
>> ({!join from=member_profile_doc_id to=id}language_proficiency_id_number:[30 
>> TO 50])
>
> The {!join...} part of that is a localParam.  It must precede the entire 
> query.  If you want to add parens, here's how you would need to do it:
> 
> {!join from=member_profile_doc_id to=id}(language_proficiency_id_number:[30 
> TO 50])
>
> With the left parenthesis where you placed it, the localParam is 
> considered part of the query itself.  It becomes incorrect Solr syntax 
> at that point.
> 
> Thanks,
> Shawn

Shawn,

Thank you for the response and I apologize for the delayed reply.

If I do the query with the localParam as you show it works, however as my 
queries become more complex with multiple terms and fields I'm finding it 
difficult to get the join localParam to work.

For example, when I was first playing with the above range query, I was able to 
get this to work with nested localParams within the parenthesis:

+({!join from=member_profile_doc_id to=id}language_noun:english
 ({!join from=member_profile_doc_id to=id}language_proficiency_id_number:30
  {!join from=member_profile_doc_id to=id}language_proficiency_id_number:40 
  {!join from=member_profile_doc_id to=id}language_proficiency_id_number:50))

This would work, but as soon as I used the range query with the square brackets 
it would fail, hence why I thought was an issue.

As I've been trying queries it seemed to me that I need to have the localParam 
before each field:term pair to get results.

Another example, this first query yields the results that I am expecting. Note 
the parenthesis wrapping each localParam and field:term pair. In this case 
there are two documents that both have the same "member_profile_doc_id" that 
are matching the two two queries (language and certification).

+({!join from=member_profile_doc_id to=id}language_noun:english)
+({!join from=member_profile_doc_id to=id}certification_authority_id_number:50)

If I move the localParams outside and no longer declare them with each 
field:term pair then no results are returned, example query:

{!join from=member_profile_doc_id to=id}(+language_noun:english 
+certification_authority_id_number:50)

Unfortunately the documentation for the join localParams only gives a simple 
field:term example so I've had to experiement with more complex queries to 
figure out how to get it to work. 

`Mark

Reply via email to