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 Ray Cheng <rc...@rocketmail.com> on 2014/01/03 02:05:04 UTC

Re: config JoinQParserPlugin

Hi Chris,

> but also exactly what response you got
I didn't get any response. Even with debug=true, there was nothing at all printed after the curl command. Nothing on the Solr log file either. (Are there higher debug levels on Solr log?) That was the reason I thought I needed to add JoinQParserPlugin explicitly in solrconfig.xml.

Thanks for your and other email saying JoinQParserPlugin is Solr already. After reading your email, I tried a simple example of collections "brands" and "products" used in this url:
http://stackoverflow.com/questions/12665797/is-solr-4-0-capable-of-using-join-for-multiple-core


I also added -v to curl with !join syntax and saw some output:
< HTTP/1.1 400 Bad Request
< Content-Length: 0

Then, I tried join syntax from Solr admin console and browser rather than using curl. After a few tries, cross core join worked with the simple "brands" and "products" collections! :) So, as you said, both of the following worked:

http://localhost:8983/solr/brands/select?q=*:*&fq={!join from=brand_id to=id fromIndex=products_shard1_replica1}name:iPad
http://localhost:8983/solr/brands/select?q=*:*&fq={!type=join from=brand_id to=id fromIndex=products_shard1_replica1}name:iPad

However, without _shard1_replica1 in "products",
http://localhost:8983/solr/brands/select?q=*:*&fq={!join from=brand_id to=id fromIndex=products}name:iPad

gave this error: (I'm using SolrCloud from sole-4.6.0)
msg">Cross-core join: no such core products


It is inconvenient to specify the exact shard and replica on join queries. But, this is a good step forward for me. I'll try my more complicated schemas now. Thanks so much to you and others' replies!

Ray






On Tuesday, December 31, 2013 8:47 AM, Chris Hostetter <ho...@fucit.org> wrote:
 

>: Earlier I tried join queries using curl 
>: 'http://myLinux:8983/solr/abc.edu_up/select?debug=true&q=*:*&fq={defType=join 
>: from=id to=id
 fromIndex=abc.edu}subject:financial'  but didn't get any 
>: response. There was nothing on Solr log either. So, I thought I need to 
>: config join. Is there another way to at least get some response from 
>: join queries?
>
>When posting questions, it's important to not only show the URLs you 
>tried, but also exactly what response you got -- in this case you have 
>debuging turned on (good!) but you don't show us what the debugging 
>information returend.
>
>from whati can tell, you are missunderstanding how to use localparams 
>and the use of "type" vs "defTpe" in local params.  
>
>1) the syntax for local params is "{!p1=v1 p2=v2 ...}" ... note the "!", 
>it's important, otherwise the "{...}" is just treated as input to the 
>default parser.
>
>2) inside local params, you use the "type" param to indicate which parser 
>you want to use (or as a shorthand just specify the parser name 
>immediately after the "!"
>
>3) if you use "defType" as a localparam, it controls which parser is used 
>for parsing hte *nested* query.
>
>    - - -
>
>So in your example, you should probably be using...
>
>/abc.edu_up/select?debug=true&q=*:*&fq={!type=join ...
>
>...or this syntactic sugar...
>
>/abc.edu_up/select?debug=true&q=*:*&fq={!join ...
>
>
>If that still isn't working for you, please show us what output you do 
>get, and some
 examples of the same query w/o the join filter (as well as 
>showing us what the nested join query produces on it's own so we can 
>verify you have docs matching it)
>
>

Re: config JoinQParserPlugin

Posted by Kranti Parisa <kr...@gmail.com>.
Ray,

FYI: there are more sophisticated joins available via
https://issues.apache.org/jira/browse/SOLR-4787
not on trunk yet, but worth taking a look.

Thanks,
Kranti K. Parisa
http://www.linkedin.com/in/krantiparisa



On Thu, Jan 2, 2014 at 8:05 PM, Ray Cheng <rc...@rocketmail.com> wrote:

> Hi Chris,
>
> > but also exactly what response you got
> I didn't get any response. Even with debug=true, there was nothing at all
> printed after the curl command. Nothing on the Solr log file either. (Are
> there higher debug levels on Solr log?) That was the reason I thought I
> needed to add JoinQParserPlugin explicitly in solrconfig.xml.
>
> Thanks for your and other email saying JoinQParserPlugin is Solr already.
> After reading your email, I tried a simple example of collections "brands"
> and "products" used in this url:
>
> http://stackoverflow.com/questions/12665797/is-solr-4-0-capable-of-using-join-for-multiple-core
>
>
> I also added -v to curl with !join syntax and saw some output:
> < HTTP/1.1 400 Bad Request
> < Content-Length: 0
>
> Then, I tried join syntax from Solr admin console and browser rather than
> using curl. After a few tries, cross core join worked with the simple
> "brands" and "products" collections! :) So, as you said, both of the
> following worked:
>
> http://localhost:8983/solr/brands/select?q=*:*&fq={!join from=brand_id
> to=id fromIndex=products_shard1_replica1}name:iPad
> http://localhost:8983/solr/brands/select?q=*:*&fq={!type=joinfrom=brand_id to=id fromIndex=products_shard1_replica1}name:iPad
>
> However, without _shard1_replica1 in "products",
> http://localhost:8983/solr/brands/select?q=*:*&fq={!join from=brand_id
> to=id fromIndex=products}name:iPad
>
> gave this error: (I'm using SolrCloud from sole-4.6.0)
> msg">Cross-core join: no such core products
>
>
> It is inconvenient to specify the exact shard and replica on join queries.
> But, this is a good step forward for me. I'll try my more complicated
> schemas now. Thanks so much to you and others' replies!
>
> Ray
>
>
>
>
>
>
> On Tuesday, December 31, 2013 8:47 AM, Chris Hostetter <
> hossman_lucene@fucit.org> wrote:
>
>
> >: Earlier I tried join queries using curl
> >: '
> http://myLinux:8983/solr/abc.edu_up/select?debug=true&q=*:*&fq={defType=join
> >: from=id to=id
>  fromIndex=abc.edu}subject:financial'  but didn't get any
> >: response. There was nothing on Solr log either. So, I thought I need to
> >: config join. Is there another way to at least get some response from
> >: join queries?
> >
> >When posting questions, it's important to not only show the URLs you
> >tried, but also exactly what response you got -- in this case you have
> >debuging turned on (good!) but you don't show us what the debugging
> >information returend.
> >
> >from whati can tell, you are missunderstanding how to use localparams
> >and the use of "type" vs "defTpe" in local params.
> >
> >1) the syntax for local params is "{!p1=v1 p2=v2 ...}" ... note the "!",
> >it's important, otherwise the "{...}" is just treated as input to the
> >default parser.
> >
> >2) inside local params, you use the "type" param to indicate which parser
> >you want to use (or as a shorthand just specify the parser name
> >immediately after the "!"
> >
> >3) if you use "defType" as a localparam, it controls which parser is used
> >for parsing hte *nested* query.
> >
> >    - - -
> >
> >So in your example, you should probably be using...
> >
> >/abc.edu_up/select?debug=true&q=*:*&fq={!type=join ...
> >
> >...or this syntactic sugar...
> >
> >/abc.edu_up/select?debug=true&q=*:*&fq={!join ...
> >
> >
> >If that still isn't working for you, please show us what output you do
> >get, and some
>  examples of the same query w/o the join filter (as well as
> >showing us what the nested join query produces on it's own so we can
> >verify you have docs matching it)
> >
> >
>