Skip to content

Instantly share code, notes, and snippets.

@mmcfarland
Last active December 15, 2015 20:09
Show Gist options
  • Save mmcfarland/5316089 to your computer and use it in GitHub Desktop.
Save mmcfarland/5316089 to your computer and use it in GitHub Desktop.
dor parcel shp2pgsql -> autocomplete searchable
alter table dor_parcels add column full_address varchar(500);
update dor_parcels set full_address = coalesce(house, 0) || ' ' || coalesce(stdir, '') || ' ' || coalesce(stnam, '') || ' ' || coalesce(stdes, '');
create index parcel_addr_idx on dor_parcels (full_address);
alter table dor_parcels add column ts_f_address tsvector;
update dor_parcels set ts_f_address = to_tsvector('english', coalesce(full_address,''));
create index textsearch_address on dor_parcels using gin(ts_f_address);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment