CQLSH COMMANDS
----------------------------------

Query join example
---------------------

CREATE KEYSPACE internet WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'Solr' : 1 };
USE internet;
CREATE TABLE songs (song uuid PRIMARY KEY, title text, artist text);
CREATE TABLE lyrics (song uuid, id uuid, words text, PRIMARY KEY (song, id));
INSERT INTO internet.songs (song, title, artist) VALUES (a3e64f8f-bd44-4f28-b8d9-6938726e34d4, 'Dangerous', 'Big Data');
INSERT INTO internet.songs (song, title, artist) VALUES (8a172618-b121-4136-bb10-f665cfc469eb, 'Internet Love Song', 'John Cedrick');
INSERT INTO internet.songs (song, title, artist) VALUES (2b09185b-fb5a-4734-9b56-49077de9edbf, 'Online', 'Brad Paisley');
INSERT INTO internet.lyrics (song, id, words) VALUES (a3e64f8f-bd44-4f28-b8d9-6938726e34d4, 62c36092-82a1-3a00-93d1-46196ee77204, 'It must be fate, I found a place for us\n I bet you didn''t know someone could love you this much');
INSERT INTO internet.lyrics (song, id, words) VALUES (8a172618-b121-4136-bb10-f665cfc469eb, 7db1a490-5878-11e2-bcfd-0800200c9a66, 'This is my internet love song\n Doo bee doo bee do\n W w w. I like you\n . . .\n Tweet her 143 I miss you, I love you');
INSERT INTO internet.lyrics (song, id, words) VALUES (2b09185b-fb5a-4734-9b56-49077de9edbf, 3715e600-2eb0-11e2-81c1-0800200c9a66, 'Hey, I''m cooler online\n Yeah, I''ll see ya online\n Hey, I''m cooler online');

Recursive Query Time Join Example
----------------------------------

CREATE TABLE videos (song uuid, award boolean, title text, PRIMARY KEY (song));
INSERT INTO videos (song, award, title) VALUES (a3e64f8f-bd44-4f28-b8d9-6938726e34d4, true, 'Facehawk');
INSERT INTO videos (song, award, title) VALUES (8a172618-b121-4136-bb10-f665cfc469eb, false, 'untitled utube');
INSERT INTO videos (song, award, title) VALUES (2b09185b-fb5a-4734-9b56-49077de9edbf, true, 'Whiskey Lullaby');


COMMANDS FOR POSTING THE SCHEMAS AND CONFIGURATION FILEs AND CREATING CORES
-------------------------------------------------------------------------------

Execute these commands in the songs directory:

curl http://localhost:8983/solr/resource/internet.songs/solrconfig.xml --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/resource/internet.songs/schema.xml --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'
curl "http://localhost:8983/solr/admin/cores?action=CREATE&name=internet.songs"

Execute these commands in lyrics directory:

curl http://localhost:8983/solr/resource/internet.lyrics/solrconfig.xml --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/resource/internet.lyrics/schema.xml --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'
curl "http://localhost:8983/solr/admin/cores?action=CREATE&name=internet.lyrics"

Execute these commands in the videos directory:

curl http://localhost:8983/solr/resource/internet.videos/solrconfig.xml --data-binary @solrconfig.xml -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/resource/internet.videos/schema.xml --data-binary @schema.xml -H 'Content-type:text/xml; charset=utf-8'
curl "http://localhost:8983/solr/admin/cores?action=CREATE&name=internet.videos"

SOLR JOIN QUERY
--------------------
Command line version of query for Query Join Example:
curl 'http://localhost:8983/solr/internet.songs/select/?q=\{!join+fromIndex=internet.lyrics\}words:love&indent=true&wt=json'

Browser version of query for Query Join Example:
http://localhost:8983/solr/internet.songs/select/?q={!join+fromIndex=internet.lyrics}words:love&indent=true&wt=json

Command line version of query for Recursive Query Join Example:
curl 'http://localhost:8983/solr/internet.songs/select/?q=\{!join+fromIndex=internet.lyrics\}words:love+AND+_query_:\{!join+fromIndex=internet.videos\}award:true&indent=true&wt=json'

Browser version of query for Recursive Query Join Example:
http://localhost:8983/solr/internet.songs/select/?q={!join+fromIndex=internet.lyrics}words:love%20AND%20_query_:{!join+fromIndex=internet.videos}award:true&indent=true&wt=json
