Alix Axel
Alix Axel

Reputation: 154543

Freebase MQL Query - Sort by Relevance

Say I have the following MQL query:

[{
  "id": null,
  "name": null,
  "type": "/base/givennames/given_name",
  "sort": "name",
  "limit": 100
}]

I get a list of the first 100 names sorted alphabetically:

[
  {
    "id": "/wikipedia/fr/Ay$015Fe",
    "name": "A'isha",
    "type": "/base/givennames/given_name"
  },
  {
    "id": "/en/aadu",
    "name": "Aadu",
    "type": "/base/givennames/given_name"
  },
  {
    "id": "/m/0g9wn3v",
    "name": "Aage",
    "type": "/base/givennames/given_name"
  },
  {
    "id": "/en/aakarshan",
    "name": "Aakarshan",
    "type": "/base/givennames/given_name"
  },
  ...
]

Is there a way to get the 100 most relevant / common / important names instead?

I want to do this for a number of queries, not just given names - so I am not exactly sure how to define the relevancy metric. Perhaps by sorting by the number of inbound links to the id with a subquery?

The search API returns a score element, but I believe it's a relevancy metric related to the search query term (null in this case). I just started with MQL yesterday and I have no idea if this is possible.

Upvotes: 1

Views: 337

Answers (1)

Shawn Simister
Shawn Simister

Reputation: 4603

You can do this with the Search API like this:

https://www.googleapis.com/freebase/v1/search?filter=(all+type:/base/givennames/given_name)&limit=100

This will give you a list of 100 given names. We don't give out the exact details of how they're ordered but the number of links is definitely a factor.

Upvotes: 2

Related Questions