Project

General

Profile

Bug #2222

Bug in squery when using not-contains

Added by Saurabh Garg about 15 years ago. Updated almost 15 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
metacat
Target version:
Start date:
10/05/2005
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
2222

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') ;

History

#1 Updated by Saurabh Garg almost 15 years ago

Fixed. Closing the bug as it seems to be working fine.

#2 Updated by Redmine Admin over 7 years ago

Original Bugzilla ID was 2222

Also available in: Atom PDF