lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "Join" by HossMan
Date Fri, 16 Dec 2011 21:06:06 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "Join" page has been changed by HossMan:
http://wiki.apache.org/solr/Join?action=diff&rev1=7&rev2=8

Comment:
attempt to clarify concept compared to SQL

  = Input Parameters =
  
  Joins are process using Solr's LocalParams syntax.  The query typically looks like:
- {{{q={!join+from=manu_id_s to=id}ipod}}}
+ {{{q={!join from=manu_id_s to=id}ipod}}}
  
- Thus, you need the join !QueryParser(Plugin) which is specified by the {!join} syntax. 
Then, you need specify the foreign key relationship by giving the from and to fields to join
on. 
+ Thus, you need the join !QueryParser(Plugin) which is specified by the {{{ {!join} }}} syntax.
 Then, you need specify the foreign key relationship by giving the from and to fields to join
on. 
  
  = Examples =
  
@@ -26, +26 @@

   * Find all products matching ipod (sorted by score) and filter that by the set of products
produced by joining manufacturers named "Belkin" or "Apple"
     * http://localhost:8983/solr/select?q=ipod&fl=*,score&sort=score+desc&fq={!join+from=id+to=manu_id_s}compName_s:Belkin
  
- = Background =
+ = Compared To SQL =
  
-  * See https://issues.apache.org/jira/browse/SOLR-2272 for the original patch
+ For people who are use to SQL, it's important to note that Joins in Solr are not really
equivalent to SQL Joins because no information about the table being joined "from" is carried
forward into the final result.  A more appropriate SQL analogy would be an "inner query"
+ 
+ This Solr request...
+ 
+ {{{
+ /solr/collection1/select ? fl=xxx,yyy & q={!join from=inner_id to=outer_id}zzz:vvv 
+ }}}
+ 
+ Is comparable to this SQL statement...
+ 
+ {{{
+ SELECT xxx, yyy 
+ FROM collection1
+ WHERE outher_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
+ }}}
  
  
  = Quick Start =

Mime
View raw message