Opened 14 years ago

Closed 14 years ago

#221 closed defect (fixed)

CSW Query with OGC Filter Comp. Ops. GreaterThanEqualTo, LessThanEqualTo don't work

Reported by: awalsh Owned by: simonp
Priority: major Milestone: v2.5.1
Component: General Version: v2.5.0
Keywords: csw, comparison operators, lucene Cc:

Description

Using GN V2.5.0 Unstable (21/4/10) with CSW client with an OGC filter an exception occurs when using the comparison operators PropertyIsGreaterThanEqualTo and PropertyIsLessThanEqualTo. An unexpected number of records are returned.

The operators PropertyIsGreaterThan and PropertyIsLessThan work OK.

The following gives the OGC filter query posted:

<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" service="CSW" version="2.0.2" resultType="results" outputSchema="http://www.isotc211.org/2005/gmd" maxRecords="10">

<csw:Query typeNames="service,application,dataset,datasetcollection">

<csw:ElementSetName>full</csw:ElementSetName> <csw:Constraint version="1.1.0">

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">

<ogc:PropertyIsGreaterThanEqualTo>

<ogc:PropertyName>TempExtent_begin</ogc:PropertyName> <ogc:Literal>1990-01-01Z</ogc:Literal>

</ogc:PropertyIsGreaterThanEqualTo>

</ogc:Filter>

</csw:Constraint>

</csw:Query>

</csw:GetRecords>

The response is more than expected, get all 7 sample records.

Geonetwork log of above, note the Lucene query doesn't include any date range and also note the SAXParseException:

2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Lucene Query: _isTemplate:n 2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Lucene Query: +_isTemplate:n 2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Lucene Query: _isTemplate:n 2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Lucene Query: +(+_isTemplate:n) +_isTemplate:n 2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Lucene Query: _isTemplate:n 2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Lucene Query: +(+(+_isTemplate:n) +_isTemplate:n) +_isTemplate:n 2010-05-06 14:54:18,136 DEBUG [geonetwork.search] - Sorting by : [relevance,true] 2010-05-06 14:54:18,136 DEBUG [geonetwork.csw.search] - Lucene query: +(+(+(+_isTemplate:n) +_isTemplate:n) +_isTemplate:n) +(_op0:2 _op0:1 _op0:0 _op0:-1 _owner:1) 2010-05-06 14:54:18,433 ERROR [geonetwork.search] - Errors occurred when trying to parse a filter: 2010-05-06 14:54:18,433 ERROR [geonetwork.search] - ---------------------------------------------- 2010-05-06 14:54:18,433 ERROR [geonetwork.search] - org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ogc:PropertyIsGreaterThanEqualTo'. One of '{"http://www.opengis.net/ogc":spatialOps, "http://www.opengis.net/ogc":comparisonOps, "http://www.opengis.net/ogc":logicOps, "http://www.opengis.net/ogc":_Id}' is expected. 2010-05-06 14:54:18,433 ERROR [geonetwork.search] - ---------------------------------------------- 2010-05-06 14:54:18,433 DEBUG [geonetwork.search] - Setting up the TFC with numHits 11 2010-05-06 14:54:18,433 DEBUG [geonetwork.csw.search] - Records matched : 7 2010-05-06 14:54:18,433 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:18,527 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:18,605 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:18,698 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:18,745 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:18,777 WARN [jeeves.webapp.csw] - SearchController : Metadata not found or invalid schema : 12 2010-05-06 14:54:18,777 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:18,808 WARN [jeeves.webapp.csw] - SearchController : Metadata not found or invalid schema : 15 2010-05-06 14:54:18,808 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:54:19,183 INFO [jeeves.service] - -> dispatching to output for : csw 2010-05-06 14:54:19,198 INFO [jeeves.service] - -> writing xml for : csw 2010-05-06 14:54:19,214 DEBUG [jeeves.service] - Service xml is : <csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">

<csw:SearchStatus timestamp="2010-05-06T14:54:18" /> <csw:SearchResults numberOfRecordsMatched="7" numberOfRecordsReturned="7" elementSet="full" nextRecord="0">

<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">

..... ....

Also noticed the following error on the DOS console:

6/05/2010 14:54:18 org.geotools.xml.impl.ParserHandler error WARNING: cvc-complex-type.2.4.a: Invalid content was found starting with element

'ogc:PropertyIsGreaterThanEqualTo'. One of '{"http://www.opengis.net/ogc":spati

alOps, "http://www.opengis.net/ogc":comparisonOps, "http://www.opengis.net/ogc": logicOps, "http://www.opengis.net/ogc":_Id}' is expected. 6/05/2010 14:54:18 org.geotools.xml.impl.ParserHandler startElement INFO: Could not find declaration for: {http://www.opengis.net/ogc}PropertyIsGrea terThanEqualTo. Creating a mock element declaration and parsing anyways... ### Excluding compile: net.sf.saxon.event.ReceivingContentHandler::startElement

The operators GreaterThan and LessThan work OK as the following log snippet shows (Lucene query properly constructed and get proper no. of records back):

2010-05-06 14:52:05,417 INFO [jeeves.webapp.csw] - Received: <csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" service="CSW" version="2.0.2" resultType="results" outputSchema="http://www.isotc211.org/2005/gmd" maxRecords="10">

<csw:Query typeNames="service,application,dataset,datasetcollection">

<csw:ElementSetName>full</csw:ElementSetName> <csw:Constraint version="1.1.0">

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">

<ogc:And>

<ogc:PropertyIsGreaterThan>

<ogc:PropertyName>TempExtent_begin</ogc:PropertyName> <ogc:Literal>1990-01-01Z</ogc:Literal>

</ogc:PropertyIsGreaterThan> <ogc:PropertyIsLessThan>

<ogc:PropertyName>TempExtent_end</ogc:PropertyName> <ogc:Literal>2009-12-31Z</ogc:Literal>

</ogc:PropertyIsLessThan>

</ogc:And>

</ogc:Filter>

</csw:Constraint>

</csw:Query>

</csw:GetRecords> 2010-05-06 14:52:05,417 INFO [geonetwork.csw] - Dispatching operation : GetRecords 2010-05-06 14:52:06,589 INFO [geonetwork.csw.search] - Unknown queryable field : _isTemplate 2010-05-06 14:52:06,620 DEBUG [geonetwork.csw.search] - Search criteria: <BooleanQuery>

<BooleanClause required="true" prohibited="false">

<BooleanQuery>

<BooleanClause required="true" prohibited="false">

<RangeQuery fld="tempExtentBegin" lowerTxt="1990-01-01Z" inclusive="false" />

</BooleanClause> <BooleanClause required="true" prohibited="false">

<RangeQuery fld="tempExtentEnd" upperTxt="2009-12-31Z" inclusive="false" />

</BooleanClause>

</BooleanQuery>

</BooleanClause> <BooleanClause required="true" prohibited="false">

<TermQuery fld="_isTemplate" txt="n" />

</BooleanClause>

</BooleanQuery> 2010-05-06 14:52:06,667 DEBUG [geonetwork.search] - Lucene Query: tempExtentBegin:{1990-01-01z TO *} 2010-05-06 14:52:06,667 DEBUG [geonetwork.search] - Lucene Query: tempExtentEnd:{* TO 2009-12-31z} 2010-05-06 14:52:06,667 DEBUG [geonetwork.search] - Lucene Query: +tempExtentBegin:{1990-01-01z TO *} +tempExtentEnd:{* TO 2009-12-31z} 2010-05-06 14:52:06,667 DEBUG [geonetwork.search] - Lucene Query: _isTemplate:n 2010-05-06 14:52:06,667 DEBUG [geonetwork.search] - Lucene Query: +(+tempExtentBegin:{1990-01-01z TO *} +tempExtentEnd:{* TO 2009-12-31z}) +_isTemplate:n 2010-05-06 14:52:06,667 DEBUG [geonetwork.search] - Sorting by : [relevance,true] 2010-05-06 14:52:06,698 DEBUG [geonetwork.csw.search] - Lucene query: +(+(+tempExtentBegin:{1990-01-01z TO *} +tempExtentEnd:{* TO 2009-12-31z}) +_isTemplate:n) +(_op0:2 _op0:1 _op0:0 _op0:-1 _owner:1) 2010-05-06 14:52:11,105 DEBUG [geonetwork.search] - Setting up the TFC with numHits 11 2010-05-06 14:52:11,183 DEBUG [geonetwork.csw.search] - Records matched : 2 2010-05-06 14:52:11,183 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:52:11,386 INFO [geonetwork.datamanager] - XLink Resolver disabled. 2010-05-06 14:52:11,480 INFO [jeeves.service] - -> dispatching to output for : csw 2010-05-06 14:52:11,480 INFO [jeeves.service] - -> writing xml for : csw 2010-05-06 14:52:11,480 DEBUG [jeeves.service] - Service xml is : <csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">

<csw:SearchStatus timestamp="2010-05-06T14:52:05" /> <csw:SearchResults numberOfRecordsMatched="2" numberOfRecordsReturned="2" elementSet="full" nextRecord="0">

<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gml="http://www.opengis.net/gml" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:geonet="http://www.fao.org/geonetwork">

<gmd:fileIdentifier>

<gco:CharacterString>4a8068e3-6378-4990-9234-786612bf7d82</gco:CharacterString>

</gmd:fileIdentifier>

.... ....

Change History (5)

comment:1 by ticheler, 14 years ago

Milestone: v2.6.0v2.5.1

comment:2 by awalsh, 14 years ago

Actually PropertyIsGreaterThanEqualTo and PropertyIsLessThanEqualTo do work. They didn't work because I was missing the 'Or' bit. If you enter 'PropertyIsGreaterThanOrEqualTo' or 'PropertyIsLessThanOrEqualTo' the filter works.

Simon Pigot's comment (Thanks for this Simon):-

"The OGC CSW XSDs have IsGreaterThanEqualTo ie. without the Or so we should probably accept both."

Simon has put in a fix to handle both into the BlueNet MEST, see commit SVN6107 in the BlueNet MEST sandbox.

comment:3 by ticheler, 14 years ago

Owner: changed from Developers to spigot

comment:4 by ticheler, 14 years ago

Owner: changed from spigot to simonp

comment:5 by simonp, 14 years ago

Resolution: fixed
Status: newclosed

Committed silently as part of svn commit 6122

Note: See TracTickets for help on using tickets.