[Geoserver-devel] WFSDataStore.getFeatureReader ignoring Filter?

Cool - I am using up my time today with Tim looking at a WFS memory leak.

We *need* to set up a unit test for this (somehow?) before we can work on it... can you isolate your example into a JUnit test? That way I can just cut and paste - also if we can arrange a time to meet on the geotools IRC channel we can work through this together.

By setting a break point in the WFSDataStore.getFeatureReader method you should be able to watch it make (or not make) your Query.
Stepping through this code once with a debugger should tell what we need to fix fault :slight_smile:

Cheers,
Jody

hi Jody,
thanks for the reply - I didnt see it before I posted again, but here is a cut down variation with part of the filter I am using. - however it doesnt seem to matter how simple I make the filter, nor what type, it always runs it clientside.

      DataStore data=null;
      String getCapabilities ="http://…";
    Map connectionParameters = new HashMap();
    connectionParameters.put
("WFSDataStoreFactory:GET_CAPABILITIES_URL", getCapabilities );
    connectionParameters.put
(WFSDataStoreFactory.PROTOCOL.key,Boolean.FALSE);
    data = DataStoreFinder.getDataStore( connectionParameters );
      String pattern = "sometext"
      String typeName = typeName ="sde:TOPO.GAZETTEER";
      org.opengis.filter.FilterFactory2 ff =(FilterFactory2)
CommonFactoryFinder.getFilterFactory(null);
      FeatureType ft=wfsstore.getSchema(typeName);
      
      //is there a simpler way to do this?
      Vector column=new Vector();
        for (int i = 0; i < ft.getAttributeCount(); i++) { if (!ft.getAttributeType(i).getName().equals
("SHAPE")) {
            Expression left = ff.property
(ft.getAttributeType(i).getName());
            Expression right= ff.literal
(pattern);
            column.add(ff.equal(left, right, false));
          }
        }
      BinaryLogicOperator blo=ff.or(column);
      DefaultQuery query = new DefaultQuery(typeName,blo);
      query.setMaxFeatures(100);
      FeatureSource fs = wfsstore.getFeatureSource(typeName);
      FeatureCollection results = fs.getFeatures(query);
      Iterator fr = results.iterator();
      while (fr.hasNext()){...

Quoting Jody Garnett <jgarnett@anonymised.com>:

Darn this sounds messy.
    

(Sorry for the duplicate post, but thought it better to include a subject
      

line.)
    

I'm a geotools newbie, but I've setup geoserver and am querying it via
      

wfs.
    

I've created a client application using geotools 2.2.4 (I did not find it
      

easy
    

from scratch with the doco thats available)
      

Can you help us update the docs?
    

, I construct a filter and add it to a query from which I get results. the trouble is that the query only ever
      

sends
    

a this query and never includes my filter (it does use maxFeatures and
      

typeName
    

settings though). eg: from serverlog -
<?xml version="1.0" encoding="UTF-8"?>
<GetFeature xmlns="http://www.opengis.net/wfs&quot;
      

xmlns:gml="http://www.opengis.net
    

/gml" xmlns:ogc="http://www.opengis.net/ogc&quot; version="1.0.0" service="WFS"
      

outpu
    

tFormat="GML2" maxFeatures="10"><Query
      

typeName="sde:TOPO.GAZETTEER"></Query>
    

</GetFeature>

the filter does get used - but its run clientside.
  

I can see - can you tell me the filter code? I we should be able to add this to the GeoServerOnlineTest and reproduce the problem.

I have two ideas:
- it is easy to construct an invalid filter that GeoServer cannot handle (I think there is a compatibility switch somewhere?)
- It could be that the changes to the "FilterCapablities" used to make the SQLEncoder happy have messed up the WFSDataStore.

Much like with Tim last week we will do better to go through this kind of thing on IRC.
    

how can I force geotools to send a complete wfs query to the server?
      

grabbing
    

all that data from the server for clientside processing is very slow.
  

I don't think it is a matter of forcing - your Filter should of been used. Can we go through your filter check out what is being asked?

Cheers,
Jody

Wrong list,
Jody

Cool - I am using up my time today with Tim looking at a WFS memory leak.

We *need* to set up a unit test for this (somehow?) before we can work on it... can you isolate your example into a JUnit test? That way I can just cut and paste - also if we can arrange a time to meet on the geotools IRC channel we can work through this together.

By setting a break point in the WFSDataStore.getFeatureReader method you should be able to watch it make (or not make) your Query.
Stepping through this code once with a debugger should tell what we need to fix fault :slight_smile:

Cheers,
Jody

hi Jody,
thanks for the reply - I didnt see it before I posted again, but here is a cut down variation with part of the filter I am using. - however it doesnt seem to matter how simple I make the filter, nor what type, it always runs it clientside.

      DataStore data=null;
      String getCapabilities ="http://…";
    Map connectionParameters = new HashMap();
    connectionParameters.put
("WFSDataStoreFactory:GET_CAPABILITIES_URL", getCapabilities );
    connectionParameters.put
(WFSDataStoreFactory.PROTOCOL.key,Boolean.FALSE);
    data = DataStoreFinder.getDataStore( connectionParameters );
      String pattern = "sometext"
      String typeName = typeName ="sde:TOPO.GAZETTEER";
      org.opengis.filter.FilterFactory2 ff =(FilterFactory2)
CommonFactoryFinder.getFilterFactory(null);
      FeatureType ft=wfsstore.getSchema(typeName);
      
      //is there a simpler way to do this?
      Vector column=new Vector();
        for (int i = 0; i < ft.getAttributeCount(); i++) { if (!ft.getAttributeType(i).getName().equals
("SHAPE")) {
            Expression left = ff.property
(ft.getAttributeType(i).getName());
            Expression right= ff.literal
(pattern);
            column.add(ff.equal(left, right, false));
          }
        }
      BinaryLogicOperator blo=ff.or(column);
      DefaultQuery query = new DefaultQuery(typeName,blo);
      query.setMaxFeatures(100);
      FeatureSource fs = wfsstore.getFeatureSource(typeName);
      FeatureCollection results = fs.getFeatures(query);
      Iterator fr = results.iterator();
      while (fr.hasNext()){...

Quoting Jody Garnett <jgarnett@anonymised.com>:

Darn this sounds messy.
    

(Sorry for the duplicate post, but thought it better to include a subject
      

line.)
    

I'm a geotools newbie, but I've setup geoserver and am querying it via
      

wfs.
    

I've created a client application using geotools 2.2.4 (I did not find it
      

easy
    

from scratch with the doco thats available)
      

Can you help us update the docs?
    

, I construct a filter and add it to a query from which I get results. the trouble is that the query only ever
      

sends
    

a this query and never includes my filter (it does use maxFeatures and
      

typeName
    

settings though). eg: from serverlog -
<?xml version="1.0" encoding="UTF-8"?>
<GetFeature xmlns="http://www.opengis.net/wfs&quot;
      

xmlns:gml="http://www.opengis.net
    

/gml" xmlns:ogc="http://www.opengis.net/ogc&quot; version="1.0.0" service="WFS"
      

outpu
    

tFormat="GML2" maxFeatures="10"><Query
      

typeName="sde:TOPO.GAZETTEER"></Query>
    

</GetFeature>

the filter does get used - but its run clientside.
  

I can see - can you tell me the filter code? I we should be able to add this to the GeoServerOnlineTest and reproduce the problem.

I have two ideas:
- it is easy to construct an invalid filter that GeoServer cannot handle (I think there is a compatibility switch somewhere?)
- It could be that the changes to the "FilterCapablities" used to make the SQLEncoder happy have messed up the WFSDataStore.

Much like with Tim last week we will do better to go through this kind of thing on IRC.
    

how can I force geotools to send a complete wfs query to the server?
      

grabbing
    

all that data from the server for clientside processing is very slow.
  

I don't think it is a matter of forcing - your Filter should of been used. Can we go through your filter check out what is being asked?

Cheers,
Jody

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel