Revision 2487
Added by sgarg over 19 years ago
src/edu/ucsb/nceas/metacat/QueryTerm.java | ||
---|---|---|
205 | 205 |
self.append("AND nodetype LIKE 'ATTRIBUTE' AND nodename LIKE '" |
206 | 206 |
+ attributeName + "' "); |
207 | 207 |
// and the path expression includes element content other than |
208 |
// just './' or '../'
|
|
209 |
if ((!pathexpr.startsWith(QuerySpecification.ATTRIBUTESYMBOL)) &&
|
|
208 |
// just './' or '../' |
|
209 |
if ((!pathexpr.startsWith(QuerySpecification.ATTRIBUTESYMBOL)) && |
|
210 | 210 |
(!pathexpr.startsWith("./" + QuerySpecification.ATTRIBUTESYMBOL)) && |
211 | 211 |
(!pathexpr.startsWith("../" + QuerySpecification.ATTRIBUTESYMBOL))) { |
212 | 212 |
|
213 | 213 |
self.append("AND parentnodeid IN "); |
214 | 214 |
pathexpr = QuerySpecification |
215 | 215 |
.newPathExpressionWithOutAttribute(pathexpr); |
216 |
self.append("(SELECT nodeid FROM xml_index WHERE path LIKE " |
|
217 |
+ "'" + pathexpr + "') "); |
|
218 | 216 |
} |
219 | 217 |
} |
218 |
self.append("(SELECT nodeid FROM xml_index WHERE path LIKE " |
|
219 |
+ "'" + pathexpr + "') "); |
|
220 | 220 |
} else { |
221 | 221 |
// without using XML Index; using nested statements instead |
222 | 222 |
self.append("AND parentnodeid IN "); |
Also available in: Unified diff
Fixed a bug in last commit. Doing a search like
pathquery version="1.2">
<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype><returnfield>originator/individualName/surName</returnfield><querygroup operator="INTERSECT"><queryterm casesensitive="false" searchmode="contains"><value>%</value></queryterm><queryterm casesensitive="false" searchmode="contains"><value>National Center for Ecological Analysis and Synthesis</value><pathexpr>organizationName</pathexpr></queryterm></querygroup></pathquery>
resulted in a query like this: SELECT docid,docname,doctype,date_created, date_updated, rev FROM xml_documents WHERE docid IN ((SELECT DISTINCT docid FROM xml_nodes WHERE UPPER LIKE '%ORGANIZATION OF BIOLOGICAL FIELD STATIONS%' AND parentnodeid IN )) AND (docid IN ='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 )))
where the error is that nothing is being inserted after "AND parentnodeid IN"
Fixed the last commit so that correct query is executed: