Bug #2222
closedBug in squery when using not-contains
0%
Description
For the following squery:
<pathquery version="1.2">
<querytitle>Moderator-Search</querytitle>
<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>
<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>
<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>
<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>
<returndoctype>-//NCEAS//resource//EN</returndoctype>
<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>
<returnfield>originator/individualName/surName</returnfield>
<returnfield>originator/individualName/givenName</returnfield>
<returnfield>creator/individualName/surName</returnfield>
<returnfield>creator/individualName/givenName</returnfield>
<returnfield>originator/organizationName</returnfield>
<returnfield>creator/organizationName</returnfield>
<returnfield>dataset/title</returnfield>
<returnfield>keyword</returnfield>
<querygroup operator="INTERSECT">
<queryterm searchmode="not-contains"
casesensitive="false"><value>public</value><pathexpr>dataset/access/allow/princi
pal</pathexpr></queryterm>
</querygroup></pathquery>
The key part here is:
<queryterm searchmode="not-contains"
casesensitive="false"><value>public</value><pathexpr>dataset/access/allow/princi
pal</pathexpr></queryterm>
i.e. dataset/access/allow/principal should not have 'public' value.
This request is resulting in the following query:
SELECT docid,docname,doctype,date_created, date_updated, rev FROM
xml_documents WHERE docid IN ((SELECT DISTINCT docid FROM xml_path_index
WHERE UPPER NOT LIKE '%PUBLIC%' AND path LIKE
'dataset/access/allow/principal' )) AND (docid IN(SELECT docid FROM
xml_documents WHERE lower(user_owner) ='public') OR (docid IN (SELECT
docid from xml_access WHERE = 'public' AND
perm_type = 'allow' AND (permission='4' OR permission='7'))OR
(lower(principal_name) = 'public' AND perm_type = 'allow' AND
(permission='4' OR permission='7'))) AND subtreeid IS NULL) AND docid
NOT IN (SELECT docid from xml_access WHERE =
'public' AND perm_type = 'deny' AND perm_order ='allowFirst' AND
(permission='4' OR permission='7'))OR (lower(principal_name) = 'public'
AND perm_type = 'deny' AND perm_order ='allowFirst' AND (permission='4'
OR permission='7'))) AND subtreeid IS NULL )))
This is not right as it still gives me back documents which have
'public' value in dataset/access/allow/principal. The part which is
wrong is:
SELECT DISTINCT docid FROM xml_path_index WHERE UPPER NOT LIKE
'%PUBLIC%' AND path LIKE 'dataset/access/allow/principal'
The query should be something like this: (maybe a simpler version of this)
SELECT DISTINCT docid from xml_path_index where docid NOT IN (Select
docid FROM xml_path_index WHERE UPPER LIKE '%PUBLIC%' AND path
LIKE 'dataset/access/allow/principal') ;
Updated by Saurabh Garg about 19 years ago
Fixed. Closing the bug as it seems to be working fine.