1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SELECT article.doc_nr, article.article_id, article.title, keywords.keywords, magazine.name, issue.issue_nr, issue.year, issue.volume, person.first_name, person.last_name
FROM article
INNER JOIN rel_person_article 
ON article.article_id = rel_person_article.fk_article_id 
INNER JOIN person 
ON person.person_id = rel_person_article.fk_person_id 
INNER JOIN rel_keywords_article 
ON article.article_id = rel_keywords_article.fk_article_id 
INNER JOIN keywords 
ON keywords.keywords_id = rel_keywords_article.fk_keywords_id 
INNER JOIN rel_magazine_article 
ON article.article_id = rel_magazine_article.fk_article_id 
INNER JOIN magazine 
ON magazine.magazine_id = rel_magazine_article.fk_magazine_id 
INNER JOIN rel_issue_article 
ON article.article_id = rel_issue_article.fk_article_id 
INNER JOIN issue 
ON rel_issue_article.fk_issue_id = issue.issue_id 
INNER JOIN rel_corporation_article
ON article.article_id = rel_corporation_article.fk_article_id 
INNER JOIN corporation
ON rel_corporation_article.fk_corporation_id = corporation.corporation_id
WHERE article_id IN
(SELECT DISTINCT article_id
FROM article 
INNER JOIN rel_person_article 
ON article.article_id = rel_person_article.fk_article_id 
INNER JOIN person 
ON person.person_id = rel_person_article.fk_person_id 
INNER JOIN rel_keywords_article 
ON article.article_id = rel_keywords_article.fk_article_id 
INNER JOIN keywords 
ON keywords.keywords_id = rel_keywords_article.fk_keywords_id 
INNER JOIN rel_magazine_article 
ON article.article_id = rel_magazine_article.fk_article_id 
INNER JOIN magazine 
ON magazine.magazine_id = rel_magazine_article.fk_magazine_id 
INNER JOIN rel_issue_article 
ON article.article_id = rel_issue_article.fk_article_id 
INNER JOIN issue 
ON rel_issue_article.fk_issue_id = issue.issue_id 
INNER JOIN rel_corporation_article
ON article.article_id = rel_corporation_article.fk_article_id 
INNER JOIN corporation
ON rel_corporation_article.fk_corporation_id = corporation.corporation_id
WHERE person.first_name 
~* '$searchTerms' 
OR person.last_name 
~* '$searchTerms' 
OR keywords.keywords 
~* '$searchTerms'
OR magazine.name 
~* '$searchTerms' 
OR magazine.short_name 
~* '$searchTerms'
OR magazine.issn 
~* '$searchTerms' 
OR issue.issue_nr 
~* '$searchTerms'
OR issue.year 
~* '$searchTerms'
OR issue.volume 
~* '$searchTerms'
OR corporation.name 
~* '$searchTerms'
OR article.title 
~* '$searchTerms'
OR article.inhalt 
~* '$searchTerms'
);