Controlling output on MQL query -- search by a field, but not output it

StackOverflow https://stackoverflow.com/questions/19505546

  •  01-07-2022
  •  | 
  •  

سؤال

I am curious if I can control the results of a query so that it will not display the a particular field in the query. For instance...

query:

[{
  "id": null,
  "name": null,
  "type": "/people/person"
}]

result:

{
  "result": [
    {
      "type": "/people/person",
      "id": "/en/jack_abramoff",
      "name": "Jack Abramoff"
    },
    {
      "type": "/people/person",
      "id": "/en/bob_ney",
      "name": "Bob Ney"
    },...

I have tried this...

[{
  "id": null,
  "name": null,
  "type": [{
    "id": "/people/person",
    "limit": 0
  }]
}]

Which gives me ...

{
  "result": [
    {
      "type": [],
      "id": "/en/jack_abramoff",
      "name": "Jack Abramoff"
    },
    {
      "type": [],
      "id": "/en/bob_ney",
      "name": "Bob Ney"
},...

I am wondering if there is a way to just get this

{
  "result": [
    {
      "id": "/en/jack_abramoff",
      "name": "Jack Abramoff"
    },
    {
      "id": "/en/bob_ney",
      "name": "Bob Ney"
    },...
هل كانت مفيدة؟

المحلول

No, there is no way to do this. Why would you need to do this? Once you parse the JSON data in your application its very easy to just ignore any values that you don't need. The APIs support using gzip compression so you don't have to worry about the response size either. If you're really optimizing for speed you might consider switching to the Search API which looks like this:

https://www.googleapis.com/freebase/v1/search?filter=(all+type:/people/person) 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top