Hello,
this is something I've been thinking about but not sure if it's
possible. I've been testing FeatureServer with GeoAlchemy to make some
queries and so far things have worked great. Now I'm trying to query a
tsvector column in this way, but FS doesn't have this option so far.
So I was wondering if it's possible to use the same and normal queries
and ulr (ie. queryable and eq, lt, like, etc, etc), and those values
(ie. tsvector column and searched value) put them as a GA query in my
model.py, so in that way I can retrieve those features. For instance:
****
url (queryable and ilike are understood by FS)
****
http://www.web.web/fs/Boreholes?format=GeoJSON&ts__ilike=yabadabadu&queryable=ts
(SQL translation: "select * from boreholes_table where ts ilike '%yabadabadu%';)
("ts__ilike=yabadabadu&queryable=ts" is understood by FS, but using
"ts" as column is not possible because the error in postgresql:
tsvector ~~* unknown)
*************************
expected SQL query
*************************
session.query(Boreholes).filter(Boreholes.ts.op('@@')(func.plainto_tsquery("yabadabadu"))).all()
(this works well as query in mymodel.py)
***************
mymodel.py
***************
#
# importing stuff - geoalchemy for postgis in declarative way
#
from sqlalchemy import *
from ... etc
#
# db connection.
#
etc...
#
# open a bound session on db
#
session = sessionmaker(bind=engine)()
#
# define tsvector class
#
class TsVector(types.UserDefinedType):
def get_col_spec(self):
return 'TSVECTOR'
#
# define classes
#
class Boreholes(Base):
__tablename__ = 'boreholes_table'
id = Column(SMALLINT, primary_key=True)
fid = Column(SMALLINT)
comments = Column(TEXT)
ts = Column(TsVector)
geom = GeometryColumn(Point(3))
#
# enable DDL extension, which allows CREATE/DROP operations to work
correctly. this is not needed if working with externally defined
tables.
#
GeometryDDL(Boreholes.__table__)
so I was thinking about something that could be written in mymodel.py
to "translate" the url to get the expected SQL query above. I'd
appreciate any hint on this, thanks in advance,
Best regards,
Gery