Question

We have some geographic data, you can think them as the places or geonames.

We have almost six hundred thousands of records, each record have the following fields:

id name lng lat  ....

Now we want to search according to this fields and support the fuzzy search , but use the like by database is not a good idea.

So we tried Lucene to do the fulltext search, this works well for the name field query, but it I have no idea when query and mix the name field and lng lat fields together.

For example, the user may want to query the places contains keywords "xxx" around a certain point with lat:30,lng 40 with distance 100 meter.

This is a kind of geographic query, which I think it is better to query by the spatial db like postgis or something else,but how about the `name field?

Was it helpful?

Solution

HGUser, PostgreSQL and SQL Server (2008 onwards - 2012 is best) are both great options that meet your requirements. Both support FULL TEXT searching and Spatial Queries with Indexing (either as singular or combined WHERE clauses).

Just make sure to construct a geography / geometry object from your lat / long coordinates to benefit from the Spatial indexing.

For PostgreSQL

You can read about Geography / Geometry within the User Manual at

http://www.postgresql.org/files/documentation/pdf/9.3/postgresql-9.3-A4.pdf (section 8.8)

And Full Text will be found at Chapter 12 of the same document.

For SQL Server

You can read about Geography / Geometry at

http://technet.microsoft.com/en-us/library/ff848797.aspx

And full text indexes at

http://technet.microsoft.com/en-us/library/ms142571.aspx

OTHER TIPS

Ciao, you have many options without touching full blown spatial DBMS. I would actually look into:

Regards, Simone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top