GET /v1/autocomplete is like /v1/search, but the last word of text is treated as unfinished and matches as a prefix. eiffel tow finds the Eiffel Tower.
Parameters
| Parameter | Type | Default | Meaning |
|---|---|---|---|
text | string | required | Place name, address, or both. Only letters and digits count; at most 12 words are used. |
size | integer 1–40 | 10 | Number of results. |
layers | list | both | Comma-separated: venue (points of interest), address (street addresses). |
boundary.country | list | every country | Comma-separated ISO 3166-1 alpha-2 codes, any case. |
focus.point.lat | number −90–90 | none | Latitude of a point whose surroundings rank higher. Set with focus.point.lon. |
focus.point.lon | number −180–180 | none | Longitude of that point. Set with focus.point.lat. |
Example
curl 'http://localhost:4000/v1/autocomplete?text=new%20yo&focus.point.lat=40.758&focus.point.lon=-73.9855&size=1'
{
"features": [
{
"geometry": {
"coordinates": [
-73.986192,
40.758627
],
"type": "Point"
},
"properties": {
"confidence": 0.5,
"country": "United States",
"country_code": "US",
"county": "New York County",
"distance": 0.091,
"gid": "geolith:venue:3387986674459602598",
"id": "3387986674459602598",
"importance": 0.9980999827384949,
"label": "New York Marriott Marquis, Manhattan, New York, United States",
"layer": "venue",
"locality": "Manhattan",
"name": "New York Marriott Marquis",
"region": "New York",
"source": "geolith"
},
"type": "Feature"
}
],
"geocoding": {
"attribution": "https://search.geolith.app/attribution",
"engine": {
"name": "geolith-search",
"version": "0.1.0"
},
"query": {
"ranking": "importance+distance",
"size": 1,
"text": "new yo",
"tinql": "\"new\" AND yo*"
},
"version": "0.2"
},
"type": "FeatureCollection"
}
How the last word matches
- A last word of two characters or more is matched as a prefix in the index (
yo*in thetinqlabove). It stays required even when the other words relax. - A one-character last word after other words would match most of the dictionary, so the other words are searched and their matches are filtered on that character.
- A lone one-character
textmatches exactly.