You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2011/09/27 20:46:27 UTC

[Solr Wiki] Update of "Join" by HossMan

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=3&rev2=4

Comment:
some in depth examples explaining usage

  In many cases, documents have relationships between them and it is too expensive to denormalize them.  Thus, a join operation is needed.  Preserving the document relationship allows documents to be updated independently without having to reindex large numbers of denormalized documents.  
  
  = Quick Start =
+ 
+ /!\ '''NOTE:''' The "browse" example of join doesn't seem to be working with the 4x example velocity templates as of 2011-09-27
  
   * Follow the Tutorial at http://lucene.apache.org/solr/tutorial.html to get setup
   * Point your browser at http://localhost:8983/solr/browse?&queryOpts=join
@@ -23, +25 @@

  
  = Examples =
  
+ In the example data, product all documents have a unique "id" field, but documents modeling products also have a "manu_id_s" which is essentially a "foreign key" to the "id" of the associated manufacturer doc.
+ 
+  * Find all product docs matching "ipod", then join them against (manufacturer) docs and return the list of manufactures that make those products
+    * http://localhost:8983/solr/select?q={!join+from=manu_id_s+to=id}ipod
+  * Find all manufacturer docs named "belkin", then join them against (product) docs and return the list of products produced by that manufacturer...
+    * http://localhost:8983/solr/select?q={!join+from=id+to=manu_id_s}compName_s:Belkin
+  * Find all manufacturer docs named "belkin", then join them against (product) docs and filter that list to only products with a price less then 12 dollars...
+    * http://localhost:8983/solr/select?q={!join+from=id+to=manu_id_s}compName_s:Belkin&fq=price:%5B%2A+TO+12%5D
+  * 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 =
  
   * See https://issues.apache.org/jira/browse/SOLR-2272 for the original patch