Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8144905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:30:11+00:00 2026-06-06T13:30:11+00:00

Does anyone know how to order Facebook places by distance from a search location?

  • 0

Does anyone know how to order Facebook places by distance from a search location? Note that I don’t want to order results in my client app. I want the Facebook server to provide me with ordered results to facilitate pagination. I always want to append places from subsequent queries to the end of my array.

This does not seem possible using the graph API query such as:

https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=1000&…. because there is no way to tell Facebook to order the results. The nearest place may be last in the list of returned results.

I have been trying to replicate the above query using FQL but have a problem in that the name & description fields in the Facebook place table are not indexable. FQL such as:

SELECT 
  page_id, name, display_subtext, description, 
  distance(latitude, longitude, "37.76", "-122.427"), checkin_count 
FROM place 
WHERE ((distance(latitude, longitude, "37.76", "-122.427") < 25000) 
  AND (strpos(lower(name), "coffee") >= 0 
  OR strpos(lower(description), "coffee") >= 0))
ORDER BY distance(latitude, longitude, "37.76", "-122.427") ASC 
LIMIT 20 OFFSET 0

Problem with this is that the fields name and description are not indexable in the place table. This means that not all the results are returned by the FQL, there are many missing results.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:30:11+00:00Added an answer on June 6, 2026 at 1:30 pm

    It seems like it’s possible using this FQL. The contains function seems to work the same as the q= Graph API param. Here’s your example using contains

    SELECT page_id, name, description, latitude, longitude, checkin_count, distance(latitude, longitude, "37.76", "-122.427")
    FROM place
    WHERE distance(latitude, longitude, "37.76", "-122.427") < 1000
    AND CONTAINS("coffee")
    ORDER BY distance(latitude, longitude, "37.76", "-122.427")
    LIMIT 20
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how to use the rank by distance search option that is
Does anyone know whether it is possible to change the tab order that tabs
Does anyone know about a fast OrderedSet implementation for python that: remembers insertion order
Does anyone know how to sort the contact data that phonegap liberates from iOS
Does anyone know how to programmatically move/order the pages and subsites that appear in
Does anyone know a way to re-order table columns, using jQuery? I don't mean
Does anyone know how to write a Regex.Split in order to convert {video=my/video/file.flv,my/location.jpg} into
Does anyone know of any websites, or (preferably) downloadable packages that you can use
Does anyone know of an existing way to change the order of an existing
Does anyone know how to modify the following string in order to display the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.