Skip to content

Commit

Permalink
Merge pull request #18 from geocode-city/next
Browse files Browse the repository at this point in the history
Make autocomplete more accurate
  • Loading branch information
lfborjas authored Jan 28, 2021
2 parents 4c53b38 + fe6381f commit 7f2fdb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist-newstyle/
Dockerfile
.dockerignore
.git/
seeds/
6 changes: 3 additions & 3 deletions src/Database/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ findApiKey key = do
cityAutoComplete :: Has Database sig m => Text -> Maybe Int -> m [CityQ]
cityAutoComplete q limit' = do
let limit = defaultLimit 5 limit'
query
"select * from geocode.city_autocomplete where name %> ? limit ?"
(q, limit)
query
"select * from geocode.city_autocomplete where name %> ? order by name <-> ?, population desc limit ?"
(q, q, limit)

-- | Slightly slower, but more precise, query to find a city that
-- partially matches a name: it looks at alternate names, and
Expand Down

0 comments on commit 7f2fdb2

Please sign in to comment.