README.md aktualisiert
parent
a44f764e52
commit
134a3246d5
33
README.md
33
README.md
|
@ -10,11 +10,11 @@ Die Befehle können in Cassandra Web mit der Adresse `localhost:3000` oder im Do
|
|||
|
||||
sudo docker exec -it cass1 cqlsh
|
||||
|
||||
Hinweis: Die `MATERIALZIED VIEWS` und `CUSTOM INDEX` sind bereits im [Startup-Skript](https://github.com/Miracle-Fruit/kikeriki/blob/main/cassandra/startup/setup/setup_db.sh) erstellt und müssen nicht erneut ausgeführt werden.
|
||||
Hinweis: Die `MATERIALZIED VIEWS` und `CUSTOM INDEX` sind bereits im [Startup-Skript](./startup/setup/setup_db.sh) erstellt und müssen nicht erneut ausgeführt werden.
|
||||
|
||||
## Queries
|
||||
|
||||
Alle Queries finden Sie auch [hier](https://github.com/Miracle-Fruit/kikeriki/tree/main/cassandra/startup/queries).
|
||||
Alle Queries finden Sie auch [hier](./startup/queries).
|
||||
|
||||
1. Auflisten der Posts, die von einem Account gemacht wurden, bzw. ihm zugeordnet wurden
|
||||
|
||||
|
@ -52,33 +52,35 @@ print("100 accounts that follow the most of the accounts found in 2)",followed_t
|
|||
* 4.1 und 4.2 die Anzahl der Follower && die Anzahl der verfolgten Accounts
|
||||
|
||||
|
||||
SELECT follower_len, follows_len FROM twitter.user_stats WHERE user_id = 233248636; //check user_id can be changed
|
||||
```SELECT follower_len, follows_len FROM twitter.user_stats WHERE user_id = 233248636; //check user_id can be changed```
|
||||
|
||||
![result_ex4_1](img/ex4_1.png)
|
||||
|
||||
|
||||
* 4.3 wahlweise die 25 neusten (zeitbasiert) oder die 25 beliebtesten Posts (like-basiert) der verfolgten Accounts (per DB-Abfrage)
|
||||
|
||||
25 neuste
|
||||
25 neuste
|
||||
|
||||
CREATE MATERIALIZED VIEW twitter.start_view_new AS
|
||||
SELECT user_id_x,follower_id,number_of_likes,number_of_shares,date_time,name,author,content,id FROM twitter.user
|
||||
WHERE user_id_x IS NOT NULL AND follower_id IS NOT NULL AND date_time IS NOT NULL AND id IS NOT NULL
|
||||
PRIMARY KEY ((user_id_x),date_time,follower_id,id);
|
||||
CREATE MATERIALIZED VIEW twitter.start_view_new AS
|
||||
SELECT user_id_x,follower_id,number_of_likes,number_of_shares,date_time,name,author,content,id FROM twitter.user
|
||||
WHERE user_id_x IS NOT NULL AND follower_id IS NOT NULL AND date_time IS NOT NULL AND id IS NOT NULL
|
||||
PRIMARY KEY ((user_id_x),date_time,follower_id,id);
|
||||
|
||||
SELECT * FROM twitter.start_view_new WHERE user_id_x = 172883064 ORDER BY date_time DESC LIMIT 25;
|
||||
SELECT * FROM twitter.start_view_new WHERE user_id_x = 172883064 ORDER BY date_time DESC LIMIT 25;
|
||||
|
||||
![result_ex4_2](img/ex4_2_date.png)
|
||||
|
||||
|
||||
25 beliebteste
|
||||
25 beliebteste
|
||||
|
||||
CREATE MATERIALIZED VIEW twitter.start_view_like AS
|
||||
SELECT user_id_x,follower_id,number_of_likes,number_of_shares,date_time,author,name,content,id FROM twitter.user
|
||||
WHERE user_id_x IS NOT NULL AND follower_id IS NOT NULL AND number_of_likes IS NOT NULL AND id IS NOT NULL
|
||||
PRIMARY KEY ((user_id_x),number_of_likes,follower_id,id);
|
||||
|
||||
// To order by the 25 most number_of_like is to our knowledge not possible with the current dataschema
|
||||
CREATE MATERIALIZED VIEW twitter.start_view_like AS
|
||||
SELECT user_id_x,follower_id,number_of_likes,number_of_shares,date_time,author,name,content,id FROM twitter.user
|
||||
WHERE user_id_x IS NOT NULL AND follower_id IS NOT NULL AND number_of_likes IS NOT NULL AND id IS NOT NULL
|
||||
PRIMARY KEY ((user_id_x),number_of_likes,follower_id,id);
|
||||
|
||||
SELECT * FROM twitter.start_view_like WHERE user_id_x = 172883064 ORDER BY number_of_likes DESC LIMIT 25;
|
||||
SELECT * FROM twitter.start_view_like WHERE user_id_x = 172883064 ORDER BY number_of_likes DESC LIMIT 25;
|
||||
|
||||
![result_ex4_2](img/ex4_2_likes.png)
|
||||
|
||||
|
@ -105,7 +107,6 @@ print("100 accounts that follow the most of the accounts found in 2)",followed_t
|
|||
|
||||
* 4.5 Auflisten der 25 beliebtesten Posts, die ein geg. Wort enthalten (falls möglich auch mit UND-Verknüpfung mehrerer Worte)
|
||||
|
||||
// To order by the 25 most number_of_like is at our knowledge not possible with the current dataschema
|
||||
CREATE CUSTOM INDEX search_in ON twitter.tweets (content) USING 'org.apache.cassandra.index.sasi.SASIIndex'
|
||||
WITH OPTIONS = { 'mode': 'CONTAINS', 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.NonTokenizingAnalyzer',
|
||||
'case_sensitive': 'false' };
|
||||
|
|
Loading…
Reference in New Issue