At some level the writer needs to read over all the features (it needs to
write out all the features), so passing a filter into the reader may act as
a delete.

On Tue, Nov 27, 2018 at 1:37 AM Peilke, Hendrik <[email protected]>
wrote:

> Hi,
>
>
>
> I use a shapefile datastore in conjunction with a transaction. When
> reading features of the store, using a filter, I mentioned, that if I have
> a dirty state (added or modified features) in the transaction I always get
> all features returned regardless of the filter.
>
>
>
> I figured out that the problem lies inside ContentFeatureSource (
> https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/store/ContentFeatureSource.java):
> When getReader(Query query) gets called, it sets in the transaction part
> the reader to
>
>
>
> new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader, state.
> getDiff());
>
>
>
> The query is not passed to the DiffFeatureReader resulting in a
> Filter.INCLUDE filter inside the DiffFeatureReader (
> https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/data/DiffFeatureReader.java),
> always returing all features.
>
>
>
> In some cases this seems to be handled in some cases inside the getReader(
> Query query) in the block following the transaction block, where it adds
> a new FilteringFeatureReader on top of the current reader. The problem is,
> for shapefiles it never gets there, because canFilter() resolves to true.
>
>
>
> My suggestion is to pass the filtert o the DiffFeatureReader by calling
>
>
>
> new DiffFeatureReader<SimpleFeatureType, SimpleFeature>(reader, 
> state.getDiff(),
> query.getFilter());
>
>
>
> Would that be the right way?
>
>
>
> Regards,
> Hendrik Peilke
>
> ------------------------------
> IBYKUS AG für Informationstechnologie, Erfurt / HRB 108616 - D-Jena /
> Vorstand: Helmut C. Henkel, Dr. Lutz Richter, Eckehart Klingner
> Vorsitzender des Aufsichtsrates: Dr. Helmut Vorndran
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to