listreamqueryitems not returning values

+1 vote

when i search for a specific key on a stream using liststreamqueryitems i do not get returned any values (there are no error messages just an empty list). However when i use liststreamkeyitems i do get a return. i need to use liststreamqueryitems as i am querying with multiple keys. i do not think the issue is my query as when i replace the specific key with another key it works fine.

to illustrate the problem i am searching for:

  • liststreamqueryitems chrom_5 '{"keys":["10059", "('0|1', '1|0')"]}'
when i search for:
  • liststreamkeyitems chrom_5 "('0|1', '1|0')" 

it works fine.
Any idea what is going on?
Thanks a lot!
asked May 6, 2022 by ae2722

1 Answer

0 votes

If you supply multiple keys to liststreamqueryitems, it only returns items with *all* of those keys. Does that apply to the items you were hoping to see?

answered May 6, 2022 by MultiChain
yes the query is to return items that have both keys (these exist in the chain). in fact if i use liststreamqueryitems and use only the key in question i.e. "('0|1', '1|0')"  i do not get a returned value just an empty list. I would expect this query to return something  identical to liststreamkeyitems
OK, this may also be an escaping issue since there are lots of quote marks in there. Please (a) post how this item appears in the output of liststreamkeyitems and (b) clarify whether you are using Linux or Windows, and how you are executing the API requests (multichain-cli, etc... )
So the request is:  liststreamkeyitems chrom_5 "('0|1', '1|0')"

A returned value has the following:
 "keys" : [
            "('0|1', '1|0')",
I am using multichain-cli + chain_name to enter into the chain terminal and then i make the request as above. I am on a linux machine.
I don't see this item also containing the key 10059
Yes I copied in the first returned item on the chain - there are multiple entries with the key "('0|1', '1|0')" including one with the key 10059. Alternatively if I do liststreamqueryitems with 33801 and "('0|1', '1|0')"  it will also return nothing.
OK. Which version please? Community or Enterprise Demo? And does the item you are looking for appear if you do either of these:

liststreamqueryitems chrom_5 '{"keys":["10059"]}'
liststreamqueryitems chrom_5 '{"keys":["('0|1', '1|0')"]}'