API : claim_search and order_by

Hi,

I’m starting with the LBRY API.

When i make a claim_search request all is working well, but adding an “order_by” argument doesn’t change the sort results (with release_time for example).

curl --header "Content-Type: application/json" -d "{\"method\": \"claim_search\", \"params\": {\"text\":\"ihu\",\"claim_type\":\"stream\",\"any_languages\":[\"fr\"],\"order_by\":[\"release_time\"]}}" http://localhost:5279

Other thing, using “publish_time” in order_by argument make an error (-32603, ‘unknown server error’), an idea ?

Thank you for this beautiful project !

That’s strange, it definitely should. Can you give us an example output of default and release time?

We should probably remove publish_time as it’s not one of the indexed/supported fields at this time - release time is better since it covers cases where publish time may not be populated.

Hi, thank you for your reply.

This is the result with release_time : https://pastebin.com/dkpeDgNt
And without (order_by empty) : https://pastebin.com/LXxC7cy8

The results are the same.

Is my CURL command correct ?

Somebody ? I really want to start a project with LBRY.

But i need to sort the results well.

Sorry about the delayed response. It does look like there’s a bug when searching via Text and the order by. If you remove the text part, it should work then.

Also, pass “no_totals” = true to get more reliable results, otherwise it may time out.

like: curl --header “Content-Type: application/json” -d “{“method”: “claim_search”, “params”: {“claim_type”:“stream”,“any_languages”:[“fr”],“order_by”:[“release_time”],“no_totals”:[“true”]}}” http://localhost:5279

Thank you again for your reply.

Unfortunately i have the same results, with exactly same order.

My goal is to sort the results by release time.

Do you have idea ?

Did you end up removing the text seach for “ihu”? What’s your current curl?

See here for my results where I checked confirmations - the one without release time sort has higher number of confirmations because its sorted by oldest content first.

C:\Users\SoloDolo>curl --header "Content-Type: application/json" -d "{\"method\": \"claim_search\", \"params\": {\"claim_type\":\"stream\",\"any_languages\":[\"fr\"],\"order_by\":[\"release_time\"],\"no_totals\":[\"true\"]}}" http://localhost:5279 | findstr confirmations
    "confirmations": 9,
          "confirmations": 29921,
        "confirmations": 19,
          "confirmations": 39732,
        "confirmations": 26,
          "confirmations": 1875,
        "confirmations": 25,
          "confirmations": 1666,
        "confirmations": 39,
          "confirmations": 240,
        "confirmations": 50,
          "confirmations": 3300,
        "confirmations": 55,
          "confirmations": 10001,
        "confirmations": 67,
          "confirmations": 14220,
        "confirmations": 51,
          "confirmations": 240,
        "confirmations": 59,
          "confirmations": 77162,
        "confirmations": 73,
          "confirmations": 16347,
        "confirmations": 73,
          "confirmations": 2094,
        "confirmations": 81,
          "confirmations": 29921,
        "confirmations": 82,
          "confirmations": 14159,
        "confirmations": 82,
          "confirmations": 18386,
        "confirmations": 88,
          "confirmations": 14159,
        "confirmations": 89,
          "confirmations": 86,
        "confirmations": 89,
          "confirmations": 39732,
        "confirmations": 58,
          "confirmations": 260279,
        "confirmations": 106,
          "confirmations": 9748,

C:\Users\SoloDolo>curl --header "Content-Type: application/json" -d "{\"method\": \"claim_search\", \"params\": {\"claim_type\":\"stream\",\"any_languages\":[\"fr\"],\"no_totals\":[\"true\"]}}" http://localhost:5279 | findstr confirmations
   "confirmations": 709508,
        "confirmations": 709508,
        "confirmations": 709508,
        "confirmations": 709508,
        "confirmations": 706884,
        "confirmations": 706480,
        "confirmations": 690196,
        "confirmations": 633005,
          "confirmations": 633046,
        "confirmations": 632999,
          "confirmations": 633046,
        "confirmations": 632468,
        "confirmations": 632689,
        "confirmations": 628075,
          "confirmations": 628075,
        "confirmations": 627547,
          "confirmations": 627547,
        "confirmations": 625477,
        "confirmations": 625215,
          "confirmations": 625216,
        "confirmations": 618631,
        "confirmations": 618622,
        "confirmations": 615642,
          "confirmations": 625216,
        "confirmations": 609365,
        "confirmations": 589672,```

You’re right, without search term the results are sorted well.

But how to have the same behavior with search term ? Is it possible ?

It’s a bug and I filed it on our repo, but we don’t have an ETA when that will be fixed since we don’t use it actively. Maybe there’s some other tags or something you can use instead?

I saw it, thank you !

Not really, i would to use it with a search query submitted by the user.

I will wait this bug will be corrected soon :crossed_fingers: