Partial Search in DAML

I went through the link :- Query language — Daml SDK 1.12.0 documentation and also did some research, but could not find how to do a partial query search in DAML.

Example :-

module ExampleModule where
template Example
 with
p : party
text : Text
where
signatory p

Now I created various contracts, for example with text field as “daml@da”

Now, i want to retrieve that contract using partial search on endpoint - /v1/query
with body as -

{
    "templateIds": [
        "ExampleModule:Example"
    ],
    "query": {
        "text": "daml"  (This would be partial query)
    }
}

How should I do this?

Thanks.

1 Like

If by “partial” query you mean that you want some sort of text matching, where this would return all the contracts for which the text field contains the word daml as a substring, this is not currently supported.

Per the documentation, the only operator we currently support are equality, greater than and lower than.

If you need other operators, at this point your only option is to do the filtering client-side.

1 Like

Thanks for this.
Can this (partial query search) be done in future releases.

1 Like

We don’t have any firm plans to expand the query language at this time, but we are always interested in user feedback here on the forum and in GitHub issues. In fact, if you have some specific formal behavior in mind (there are several ways to formalize your use case), you may wish to create an issue on GitHub so you might be notified directly on further developments.

You may also take a look at the other JSON API backlog items and “:bell: Subscribe” to any that might interest you.

2 Likes

Like this one ? :laughing:

1 Like

Indeed :slight_smile: However, I don’t think what @Enthusiast-Block is asking for is really compatible at all with what you’ve asked for. But working that out is exactly the kind of formalization and refinement that can be done well in GitHub issues.

2 Likes