How to implement full text search using postgres + geonames dump data

169 views Asked by At

we have a postgres database that contains geonames dump data, and we want to implement full text search to get the best results, for example the search for 'paris' gets the following data :

[
{
geonameid: 5381143,
name: "Paris",
latitude: 34.47194,
longitude: -118.18091,
country: "US",
cc2: null
},
{
geonameid: 4402452,
name: "Paris",
latitude: 39.48087,
longitude: -92.00128,
country: "US",
cc2: null
},
{
geonameid: 4402453,
name: "Paris Branch",
latitude: 39.05394,
longitude: -91.01875,
country: "US",
cc2: null
},
{
geonameid: 4402454,
name: "Paris Fork Cemetery",
latitude: 38.79865,
longitude: -92.12102,
country: "US",
cc2: null
},
{
geonameid: 4402455,
name: "Paris Springs",
latitude: 37.19422,
longitude: -93.67937,
country: "US",
cc2: null
},
{
geonameid: 4402456,
name: "Paris Springs Church",
latitude: 37.202,
longitude: -93.68659,
country: "US",
cc2: null
},
{
geonameid: 4402457,
name: "Paris Springs School (historical)",
latitude: 37.20144,
longitude: -93.68743,
country: "US",
cc2: null
},
{
geonameid: 4402463,
name: "Paris Fork Church",
latitude: 38.79837,
longitude: -92.12185,
country: "US",
cc2: null
},
{
geonameid: 4440270,
name: "Paris Baptist Church",
latitude: 34.17761,
longitude: -89.4548,
country: "US",
cc2: null
},
{
geonameid: 4440271,
name: "Paris Cemetery",
latitude: 34.17594,
longitude: -89.44952,
country: "US",
cc2: null
}
]

We should have paris of France as it has the priority.

0

There are 0 answers