Delivery API | Filter on whitespace

Hi all,

Having some trouble with the delivery api filter, it does not seem to support whitespace.

/umbraco/delivery/api/v2/content?filter=name:my%20article returns 0 results, despite it existing in the backend. is there something i am missing or is whitespace not supported?

Currently just want a very basic search system, will do something more advanced later on but just want a simple search on document name for now.

Thanks,
Daniel

Hi @jam ,

It could just be an issue with case sensitivity. Just to test it out, try passing the exact node name matching the casing you have in the backoffice.

The built-in name: filter in the Delivery API isn’t a full-text search. It does a strict, exact match. If the document in your backoffice is named “My Article” (capitalized), querying name:my%20article in lowercase will return 0 results. The official docs note that it expects the exact nodeName value.

Regards,
Shekhar

Hi @jam

The %20 isn’t the problem - that decodes fine. The issues is that the Delivery API uses the Examine index for queries, so node names will be stored in the index as tokens, not exact strings. So, a node with the name “My Article” will be stored as two separate tokens, My and Article.

Using /umbraco/delivery/api/v2/content?filter=name:my%20article, will look for that exact value in the index, but that as tokens are split by whitespace it never matches anything.

The alternative is to either filter by a single token and filter again on the client, or use the following instead:

GET /umbraco/delivery/api/v2/content/item/articles/my-article

I hope that helps.

Justin

Good catch, @justin-nevitech. I completely overlooked the tokenization part and just assumed it was a case-sensitivity issue. Thanks for clearing that up! Daniel, the path endpoint @justin-nevitech mentioned is the way to go.

Thanks for your input!

Sadly my hope have having a crude search functionality using the core delievery API does not seem like the best approach even as a basic / temp option, as being able to search with multiple words would be important, and i really would like to avoid filtering on the clientside.

I’ve decidced to implement the Umbraco Search package, as it also seems to offer a delivery api extention.