Documentation

Autocomplete

Search as you type, with an unfinished last word.

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

ParameterTypeDefaultMeaning
textstringrequiredPlace name, address, or both. Only letters and digits count; at most 12 words are used.
sizeinteger 1–4010Number of results.
layerslistbothComma-separated: venue (points of interest), address (street addresses).
boundary.countrylistevery countryComma-separated ISO 3166-1 alpha-2 codes, any case.
focus.point.latnumber −90–90noneLatitude of a point whose surroundings rank higher. Set with focus.point.lon.
focus.point.lonnumber −180–180noneLongitude 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 the tinql above). 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 text matches exactly.