Hi,
I’m working on http://jira.codehaus.org/browse/GEOS-6187 and as part
of it I’ve noticed that we are sometimes returning -1 as numberMatched.
Now, this is happening in situations in which we legitimately know the actual numberMatched,
so it’s a bug on its own, but, generally speaking, we might be in a situation where we don’t
know numberMatched at all:
- we are using app-schema, that cannot do counts
- we are using a complex filter in which part of the filter cannot be encoded in SQL (e.g., using
filter functions), or we are working against a shapefile and we have an attribute filter, in both
cases featureSource.getCount(…) will return -1 to state “sorry, too hard to compute”
However the spec defines the numberMatched type as follows:
<xsd:simpleType name=“nonNegativeIntegerOrUnknown”>
xsd:union
xsd:simpleType
<xsd:restriction base=“xsd:string”>
<xsd:enumeration value=“unknown”/>
</xsd:restriction>
</xsd:simpleType>
xsd:simpleType
<xsd:restriction base=“xsd:nonNegativeInteger”/>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
So, in this case, we should be generating “unknown” as the output, not -1.
As far as I can see the WFS 2.0 FeatureCollectionTypeImpl takes this into account and
defines numberMatched to be “Object”, but in gs-wfs FeatureCollectionResponse
has:
public abstract BigInteger getTotalNumberOfFeatures();
public abstract void setTotalNumberOfFeatures(BigInteger n);
Now, I see a couple ways to amend this:
- change totalNumberOfFeatures to be Object too, and set it to “unknown” in case
we have a -1
- change the feature collection binding to make an exception for numberMatched,
and if it’s null or a negative number, return “unknown” instead
Do you have a preference?
Cheers
Andrea
–
== Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information ==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Wed, Feb 26, 2014 at 7:12 PM, Andrea Aime
<andrea.aime@anonymised.com>wrote:
Now, I see a couple ways to amend this:
* change totalNumberOfFeatures to be Object too, and set it to "unknown"
in case
we have a -1
* change the feature collection binding to make an exception for
numberMatched,
and if it's null or a negative number, return "unknown" instead
In the end I went for the second approach:
https://github.com/geotools/geotools/commit/bb67ae0d41c1143d8f70bbc56c728c9b0c488e84
Cheers
Andrea
--
== Our support, Your Success! Visit http://opensdi.geo-solutions.it for
more information ==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Apologies for not getting a chance to chime in on this one, been swamped with a deliverable. Was going to review on the weekend but looked at what you committed and the approach looks fine to me.
···
On Fri, Feb 28, 2014 at 6:38 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
Geoserver-devel mailing list
Geoserver-devel@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
–
Justin Deoliveira
Vice President, Engineering | Boundless
jdeolive@anonymised.com
@j_deolive
On Wed, Feb 26, 2014 at 7:12 PM, Andrea Aime <andrea.aime@anonymised.com> wrote:
Now, I see a couple ways to amend this:
- change totalNumberOfFeatures to be Object too, and set it to “unknown” in case
we have a -1
- change the feature collection binding to make an exception for numberMatched,
and if it’s null or a negative number, return “unknown” instead
In the end I went for the second approach:
https://github.com/geotools/geotools/commit/bb67ae0d41c1143d8f70bbc56c728c9b0c488e84
Cheers
Andrea
–
== Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information ==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it