Forum Discussion

PerBonomi's avatar
7 years ago

Liql oddity

Came across this weird behavior. Wondering what your thoughts are.

Running this query:

 

select author from messages

 I get everything that belongs to the author:

 

"author" : {
        "type" : "user",
        "id" : "215",
        "href" : "/users/215",
        "view_href" : "/t5/user/viewprofilepage/user-id/215",
        "login" : "<removed>"
      }

So I can run the above query and still go on working with fields like data.items[0].author.id.

But, if I run this query:

select kudos from messages

 I only get

 "kudos" : {
        "query" : "SELECT * FROM kudos WHERE message.id = '2025'"
      }

Only when I add a restraint:

select kudos from messages where kudos.sum(weight) >= 1

Do I  suddenly get more information:

 "kudos" : {
        "query" : "SELECT * FROM kudos WHERE message.id = '1695'",
        "sum" : {
          "weight" : 1000
        }
      }

 

Is this a quirk, a bug, or , somehow, intended?

  • PerBonomi

    See the sections for which fields, functions, constraints, sorts, and HTTP calls in this collection supports for messages in the SELECT statement of a LiQL query.


    • DougS's avatar
      DougS
      Khoros Oracle

      Yep, since kudos.sum(weight) is a function, it adds that to the response when the function is added as a constraint. It's a bit strange, but I believe that's the way it's intended to work.

      -Doug