I would like to query my database by items in the keywords field in the frontmatter, which is a list/array of strings. The problem is that the ‘contains’ operator matches substrings of items. The documentation states that operator is supposed to check ‘if any of the array elements ==equals== the given value’ when the container object is a list.
Sample data:
file1.md:
---
keywords:
- apple
---
file2.md:
---
keywords:
- ap
---
My query looks like this:
TABLE keywords AS "Keywords"
WHERE contains(keywords, "ap")=true
The desired outcome is that only file2 is shown, but it turned out that file1 also showed up.
Things I have tried
I have tried changing the keywords field into a dictionary:
file1.md:
---
keywords:
- apple: [anything, or null]
---
file2.md
---
keywords:
- ap: [anything, or null]
---
This allows me to perform the desired query, however it introduces other problems, such as the display of the keywords field in a table when it contains multiple values.
Any help would appreciated!