You are running alongside the right track :) To work you implement in java (for any non PostGIS data) and then adjust the PostGIS DataStore code to map those functions to SQL.
- PostGISDialect - PostgisFIlterToSQL - FilterToSqlHelper - FilterToSqlHelper.visitFunction(function,extraData) <https://github.com/geotools/geotools/blob/main/modules/plugin/jdbc/jdbc-postgis/src/main/java/org/geotools/data/postgis/FilterToSqlHelper.java#L522> You can see the mapping being done from the GeoTools function data structure (which is why you need a java implementation) to the SQL. -- Jody Garnett On Sep 25, 2023 at 11:23:00 PM, Carsten Klein <c.kl...@datagis.com> wrote: > Hi there, > > I'd like to use some custom PostgreSQL functions as filters in standard > WFS 2.0.0 requests. The goal is to request features filtered by e.g. > Full Text Search or the word_similarity function provided by the pg_trgm > extension (Trigram/Trigraph support). > > Since WFS only provides a quite limited set of operators > (PropertyIs[Not]EqualTo, PropertyIsLessThan, PropertyIsLike, etc.), my > idea is to use my own filter functions in order to access those custom > database functions. > > In GeoTools, there is a Function tutorial explaining how to create my > own Function Factory and function implementations. However, all samples > and functions I've seen so far are implemented in Java. Is it possible > for these Filter Functions to contribute to the WHERE clause of the > actual SQL statement executed in the database? > > For a GeoServer (Data)Store, there is an option "encode functions", > causing all/most filters to be implemented in SQL for performance > reasons. Does this affect Filter Functions from those Filter Factories > as well? > > Looking at the Function's interfaces (Expression, ExpressionVisitor, > Function), I don't see any point at which SQL could come into play. Am I > on the right track? > > Any advice is appreciated :) > > Carsten > > > _______________________________________________ > Geoserver-devel mailing list > Geoserver-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geoserver-devel >
_______________________________________________ Geoserver-devel mailing list Geoserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-devel