Project

General

Profile

Bug #2155 » soil-query1.sql

Matt Jones, 09/28/2006 08:46 AM

 
1
SELECT docid,docname,doctype,date_created, date_updated, rev 
2
  FROM xml_documents 
3
 WHERE docid IN (
4
                 (SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'abstract/para' 
5
                   UNION 
6
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'givenName'  
7
                   UNION 
8
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'keyword'  
9
                   UNION 
10
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'organizationName'  
11
                   UNION 
12
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'title'  
13
                   UNION
14
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'surName'  
15
                   UNION 
16
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'para'  
17
                   UNION 
18
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'geographicDescription'
19
                   UNION 
20
                  SELECT DISTINCT docid FROM xml_path_index WHERE UPPER(nodedata) LIKE '%SOIL%' AND path LIKE 'literalLayout' 
21
                 )
22
                )  
23
   AND ( 
24
        docid IN (SELECT docid FROM xml_documents WHERE lower(user_owner) ='public') 
25
              OR (docid IN 
26
                           (
27
                                      SELECT docid from xml_access 
28
                                       WHERE (
29
                                                (
30
                                                 lower(principal_name) = 'public' 
31
                                                 AND perm_type = 'allow' 
32
                                                 AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
33
                                                )
34
                                                OR 
35
                                                (
36
                                                     lower(principal_name) = 'public' 
37
                                                     AND perm_type = 'allow' 
38
                                                     AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
39
                                                )
40
                                             ) 
41
                                         AND subtreeid IS NULL
42
                           ) 
43
                  AND docid NOT IN (
44
                                      SELECT docid from xml_access 
45
                                       WHERE (
46
                                                (
47
                                                   lower(principal_name) = 'public' 
48
                                                   AND perm_type = 'deny' 
49
                                                   AND perm_order ='allowFirst' 
50
                                                   AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
51
                                                )
52
                                                OR 
53
                                                (
54
                                                   lower(principal_name) = 'public' 
55
                                                   AND perm_type = 'deny' 
56
                                                   AND perm_order ='allowFirst' 
57
                                                   AND (permission='4' OR permission='5' OR permission='6' OR permission='7')
58
                                                )
59
                                             ) 
60
                                         AND subtreeid IS NULL 
61
                                   )
62
                 )
63
       ) 
(1-1/34)