Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Use ?q= instead of ?q=* when searching for places
Browse files Browse the repository at this point in the history
  • Loading branch information
tobilg committed Apr 5, 2016
1 parent 62f3f6c commit 0790fc7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ This implementation uses regular Facebook Graph API calls in a three-step approa

###Known limitations

* The Graph API has some "instabilities" with search results. It's possible that the amount of results returned can vary between calls within seconds
* Undocumented usage of the `q` parameter (`q=*` produced more results than `q=` or just omitting the `q` parameter)
* The Graph API has some "instabilities" with search results. It's possible that the amount of results returned can vary between calls within seconds
* The `/search` endpoint "magically" limits the number of results, independent from the `distance` used (larger distance doesn't guarantee more results)
* [Rate limiting](https://developers.facebook.com/docs/graph-api/advanced/rate-limiting) will apply, but I experienced no call blocks within a reasonable amount of service requests. Be aware that the way this application works, there are potentially hundreds of (counted) Graph API calls per request to `/events`.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "facebook-events-by-location",
"description": "A Express.js-based microservice to get public Facebook events by location.",
"keywords": "Facebook,events,event,search,location,microservice,backend,app",
"version": "0.4.1",
"version": "0.4.2",
"private": false,
"scripts": {
"start": "node ./app"
Expand Down
4 changes: 2 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function haversineDistance(coords1, coords2, isMiles) {
var x1 = lat2 - lat1;
var dLat = toRad(x1);
var x2 = lon2 - lon1;
var dLon = toRad(x2)
var dLon = toRad(x2);
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
Expand All @@ -86,7 +86,7 @@ router.get('/events', function(req, res, next) {
venuesCount = 0,
venuesWithEvents = 0,
eventsCount = 0,
placeUrl = "https://graph.facebook.com/v2.5/search?type=place&q=*&center=" + req.query.lat + "," + req.query.lng + "&distance=" + req.query.distance + "&limit=1000&fields=id&access_token=" + req.query.access_token;
placeUrl = "https://graph.facebook.com/v2.5/search?type=place&q=&center=" + req.query.lat + "," + req.query.lng + "&distance=" + req.query.distance + "&limit=1000&fields=id&access_token=" + req.query.access_token;

//Get places as specified
rp.get(placeUrl).then(function(responseBody) {
Expand Down

0 comments on commit 0790fc7

Please sign in to comment.