On Friday, November 30, 2018 at 4:52:52 AM UTC-8, Bruce Steedman wrote: > > I noticed this method briefly described in the docs > <https://github.com/jeremyevans/sequel/blob/master/doc/schema_modification.rdoc#full_text_index-and-spatial_index>. > > I just tried to use it to index columns :latitude and :longitude (both type > Float) in a PostgreSQL database and got this error in a migration: > > Sequel::DatabaseError: PG::UndefinedObject: ERROR: data type double >> precision has no default operator class for access method "gist" >> HINT: You must specify an operator class for the index or define a >> default operator class for the data type. >> <migration file>:5:in `block (2 levels) in <top (required)>' >> <path>migrate.rake:26:in `block (2 levels) in <top (required)>' >> >> Caused by: >> PG::UndefinedObject: ERROR: data type double precision has no default >> operator class for access method "gist" >> HINT: You must specify an operator class for the index or define a >> default operator class for the data type. >> > > I have since defined a normal composite index on the two columns (to > optimize searches with the geocoder gem) but I am interested in what a > spatial_index is, what it does and which databases support it. >
spatial_index sets up an index for spatial types, and in your case latitude and longitude are just regular double precision types, so it shouldn't be used. Both the MySQL and PostgreSQL adapters have code to handle spatial_index. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
