[Developers] Loss of Cursor?

Charles Guthrie cguthri at hotmail.com
Wed Jul 2 18:40:18 UTC 2008



Hey, I've noticed an odd issue where it seems that the cursor system is breaking down.  I could be mistaken, but here is what is happening:


To be specific, here is an example:


http://www.freebase.com/api/service/mqlread?query={"query":[{"A:name~=":"toad*","name":null,"type":"/common/topic","guid":null,"limit":25,"id":null,"image":[{"guid":null,"optional":true}],"/type/object/type":[{"name":null,"id":null,"guid":null}]}],"cursor":true}


This will get me:



{
  "cursor": "eNqNjsFOwzAQRD-GS6Iq6u56vXZXVcV_oB5cxy6RoIncgODvcUkp5caeVjOaNxPfynksKr2IhlOvD9Ah04YAAdRoM5yDLpJl50hfUp63XXM4voZJza9jdP6cUrdDatu70MK5hr75Qt7hzUMlbfLwkXptppLqpwSVNYa-ct6HS4dcS8RZLcPxeV7VKAUfgQFAGLOH-4uhzmBpn6YyKuz_7LFsrf3Zc8HzxtubI__iQ6x847FdGnC_FnRiCNaPJnpGDIlzOKTMVfwCDL9bWQ==", 
  "status": "200 OK", 
  "code": "/api/status/ok", 
  "result": [
    {
      "/type/object/type": [
        {
          "guid": "#9202a8c04000641f8000000000000565", 
          "id": "/common/topic", 
          "name": "Topic"
        }, 
        {
          "guid": "#9202a8c04000641f800000000585eb98", 
          "id": "/biology/organism_classification", 
          "name": "Organism Classification"
        }
      ], 
      "name": "Cane Toad", 
      "image": [], 
      "guid": "#9202a8c04000641f800000000000f592", 
      "type": "/common/topic", 
      "id": "/en/cane_toad"
    }, 
    {
      "/type/object/type": [
        {
          "guid": "#9202a8c04000641f8000000000000565", 
          "id": "/common/topic", 
          "name": "Topic"
        }, 
        {
          "guid": "#9202a8c04000641f800000000585eb98", 
          "id": "/biology/organism_classification", 
          "name": "Organism Classification"
        }
      ], 
      "name": "Toad", 
      "image": [
        {
          "guid": "#9202a8c04000641f8000000004a9209d"
        }
      ], 
      "guid": "#9202a8c04000641f800000000004c994", 
      "type": "/common/topic", 
      "id": "/guid/9202a8c04000641f800000000004c994"
    }, 
   
       ... etc



I take that cursor and refeed it back in like so:




http://www.freebase.com/api/service/mqlread?query={"query":[{"A:name~=":"toad*","name":null,"type":"/common/topic","guid":null,"limit":25,"id":null,"image":[{"guid":null,"optional":true}],"/type/object/type":[{"name":null,"id":null,"guid":null}]}],"cursor":"eNqNjsFOwzAQRD-GS6Iq6u56vXZXVcV_oB5cxy6RoIncgODvcUkp5caeVjOaNxPfynksKr2IhlOvD9Ah04YAAdRoM5yDLpJl50hfUp63XXM4voZJza9jdP6cUrdDatu70MK5hr75Qt7hzUMlbfLwkXptppLqpwSVNYa-ct6HS4dcS8RZLcPxeV7VKAUfgQFAGLOH-4uhzmBpn6YyKuz_7LFsrf3Zc8HzxtubI__iQ6x847FdGnC_FnRiCNaPJnpGDIlzOKTMVfwCDL9bWQ=="}



and get this:




{
  "cursor": "eNqNjsFuwkAMRD-ml0QowvZ6nY2FEP9RcdhuNjQSkGgJCP6-S0MpvdWnkUfzZsI5nYakxMLqj62-QYVMDQECqNGiP3mdX5brmnQfu2lVFR-7gx_V_DpGp9sYqzVSWb6EZs4j9M0XcjU-PVTSouuvsdViTDErJciswbeZc-nvHfIokdpq6nef0yJHybsADADC2Dl4veDzDJbyfUyDwvbPHsvW2p89dzw3zj4d-RcfQuYbh-XcgNtl4wwj8HJjgmNEH7nzQQTEmC_Ce1rG", 
  "status": "200 OK", 
  "code": "/api/status/ok", 
  "result": [
    {
      "/type/object/type": [
        {
          "guid": "#9202a8c04000641f8000000000000565", 
          "id": "/common/topic", 
          "name": "Topic"
        }
      ], 
      "name": "Toad doctors", 
      "image": [], 
      "guid": "#9202a8c04000641f80000000005edadc", 
      "type": "/common/topic", 
      "id": "/en/toad_doctors"
    }, 
    {
      "/type/object/type": [
        {
          "guid": "#9202a8c04000641f8000000000000565", 
          "id": "/common/topic", 
          "name": "Topic"
        }, 
        {
          "guid": "#9202a8c04000641f800000000585eb98", 
          "id": "/biology/organism_classification", 
          "name": "Organism Classification"
        }
      ], 
      "name": "Midwife toad", 
      "image": [
        {
          "guid": "#9202a8c04000641f80000000049fb116"
        }
      ], 
      "guid": "#9202a8c04000641f80000000005ee7c0", 
      "type": "/common/topic", 
      "id": "/en/midwife_toad"
    }, 

      ... etc



but then on the third iteration:




http://www.freebase.com/api/service/mqlread?query={"query":[{"A:name~=":"toad*","name":null,"type":"/common/topic","guid":null,"limit":25,"id":null,"image":[{"guid":null,"optional":true}],"/type/object/type":[{"name":null,"id":null,"guid":null}]}],"cursor":"eNqNjsFuwkAMRD-ml0QowvZ6nY2FEP9RcdhuNjQSkGgJCP6-S0MpvdWnkUfzZsI5nYakxMLqj62-QYVMDQECqNGiP3mdX5brmnQfu2lVFR-7gx_V_DpGp9sYqzVSWb6EZs4j9M0XcjU-PVTSouuvsdViTDErJciswbeZc-nvHfIokdpq6nef0yJHybsADADC2Dl4veDzDJbyfUyDwvbPHsvW2p89dzw3zj4d-RcfQuYbh-XcgNtl4wwj8HJjgmNEH7nzQQTEmC_Ce1rG"}


{
  "cursor": false, 
  "status": "200 OK", 
  "code": "/api/status/ok", 
  "result": []
}



Now, you might think that the records have run out, but I already did a count and found there were




http://www.freebase.com/api/service/mqlread?query={"query":[{"return":"count","A:name~=":"toad*","name":null,"type":"/common/topic","guid":null,"id":null,"image":[{"guid":null,"optional":true,"limit":1}],"/type/object/type":[{"name":null,"id":null,"guid":null,"optional":true}]}],"cursor":true}


{
  "cursor": true, 
  "status": "200 OK", 
  "code": "/api/status/ok", 
  "result": [
    324
  ]
}



So there should be 324 results to page through.  I've encountered this issue on several different keyword searches with type "/general/topic".  Is there something I am perhaps missing?  There is no duration of time inbetween these API calls; they are made one after the other, paging through the results in chunks.


  - charles

_________________________________________________________________
Watch “Cause Effect,” a show about real people making a real difference.  Learn more.
http://im.live.com/Messenger/IM/MTV/?source=text_watchcause


More information about the Developers mailing list