GET /:country/listings (Solr)¶
Note
This is experimental functionality which uses a Solr index to search listings. Solr provides faster search, as well as fuzzy search capabilities.
The number of returned search results is limited to 50.
URL Parameters¶
To enable Solr search:
solr
Required
|
Set to true to enable Solr search.
Example: solr=true
|
what
Optional
|
What to search for (name or category name).
Examples: what=pizza, what=Grobmeier
|
where
Optional
|
Where to search for it (place name).
Example: where=Munchen
|
lat
Optional
|
Geographic latitude.
Example: lat=43.21
|
lon
Optional
|
Geographic longitude.
Example: lon=12.34
|
category
Optional
|
Exact name of the category to match by.
Example: category=Pizzeria
|
The what and where fields feature fuzzy search so they will also match similar strings. If you want to search for an exact phrase, encase it in double quotes.
When given latitude and logitude, the results will include all places within 20 kilometers from the given center point. The resulting model will include a _dist_ field which says how far the listing is from the given center point.
Responses¶
On success returns HTTP 200 OK with the folowing data:
Key | Content / Description |
---|---|
numFound | The number of listings matching the filter. |
numReturned | The number of listings returned, can be less than numFound if it exceeds the limit of 50 listings. |
listings | An array of Listings (can be empty). |
On error returns an Error object.
Examples¶
Searching by what and where
GET http://api.opendi.de/de/listings?solr=true&what=opendi&where=munchen
HTTP 200 OK
{
"numFound": 1,
"numReturned": 1,
"listings": [
{
"id": "de:6668123",
"lid": 6668123,
"cc": "de",
"name": "Opendi AG",
"street": "40 Müllerstr.",
"zip": "80469",
"place": "München",
"partner": "yext",
"loc": "48.1312973,11.5699438",
"categories": [
"Bestatter"
],
"boost": 35,
"_version_": 1500877733700304896,
"score": 106.27542
}
}
Searching by location and category
Let’s find pizza near Opendi:
GET http://api.opendi.de/de/listings?solr=true&category=Pizzaservice&lat=48.1312973&lon=11.5699438
Sample result:
HTTP 200 OK
{
"numFound": 17,
"numReturned": 17,
"listings": [
{
"id": "de:5209886",
"lid": 5209886,
"cc": "de",
"name": "Mama Pizza",
"street": "Leopoldstr. 257",
"zip": "80807",
"place": "München",
"partner": "eigenBestand",
"loc": "48.18137,11.58456",
"rating": 5,
"categories": [
"Pizzaservice",
"Restaurant: Pizza"
],
"boost": 27,
"_version_": 1500877346787295233,
"_dist_": 5.6723990291109,
"_distboost_": 6.380644,
"score": 857.35315
},
{
"id": "de:6311268",
"lid": 6311268,
"cc": "de",
"name": "Tomate Pizza",
"street": "Rosenheimerstr. 117",
"zip": "81667",
"place": "München",
"partner": "eigenBestand",
"loc": "48.126223,11.597853",
"categories": [
"Pizzaservice",
"Gastronomiebedarf"
],
"boost": 13,
"_version_": 1500877596618915842,
"_dist_": 2.1467771543446,
"_distboost_": 8.232636,
"score": 632.11505
},
...
]
}