timwis / soda-geoservices

Query Esri Geoservices using a SODA2-style API
MIT License
7 stars 0 forks source link

Free-text search #2

Open timwis opened 8 years ago

timwis commented 8 years ago

Socrata uses $q. Geoservices documentation has a param text described as:

Description: A literal search text. If the layer has a display field associated with it, the server searches for this text in this field. This parameter is a short hand for a where clause of: where like '%%'. The text is case sensitive. This parameter is ignored if the where parameter is specified.

Example: text=Los

Doesn't sound like it. Using CONTAINS() in where may be possible, but this post suggests (a) it may not be, and (b) you have to specify the field to search on

nixta commented 8 years ago

Look like some of the quote above got mistakenly read as HTML markdown. Here's what it should say:

Description: A literal search text. If the layer has a display field associated with it, the server searches for this text in this field. This parameter is a short hand for a where clause of: where <displayField> like '%<text>%'. The text is case sensitive. This parameter is ignored if the where parameter is specified.

But anyway, does your feature service have a Display Field specified?

I'll ask around whether ArcGIS Online supports this. Offhand, I'm not entirely sure myself how to set the display field.

Also, to avoid any confusion, text is not meant to search all text fields, merely the display field.

timwis commented 8 years ago

Hey @nixta! Yes I imagine the feature services would have display fields set. I guess the real problem is that there's no way to search all text fields. I suppose if we knew what the fields where, we could construct a where clause that checks all of them, ie. where=a=x or b=x or c=x or d=x etc. though that would require us to query the API first to get a list of all the fields.

nixta commented 8 years ago

Hi @timwis, yeah, you'd query the end point to get the list of fields and could filter out the string ones and build a where clause using LIKE and OR.