Search for text including a `-`

I have entries for users in my vault with usernames like organization-role, or acme-backup for the backup service for the acme organization.

When I search in the webvault, desktop, or extension for acme-backup, it appears to search for acme or backup instead of the literal acme-backup. Which means instead of showing the 2-3 items I actually want, I get tons of items having nothing to do with what I was trying to search for. I have tried adding quotes and other things, but I am not finding the right syntax. Is there any way to search for acme-backup and get the search to actually show me the entries that have that, and only that, in one of the searchable text fields and irrelevant items?

This cannot be done, because the Lunr search engine treats the hyphen character (-) as a word separator. If your usernames contained a different separator character (e.g., acme_backup or acme.backup), then your searches would work as intended.

To search for usernames that contain a hyphen, the best you can do is to construct an advanced search query of the form:

>+login.username:acme +login.username:backup

This will find any item that has both acme AND backup in the username field. You could also try the following variant, which is less unwieldy, but also less precise:

>+acme +backup

This will find any item that has both acme AND backup anywhere in the item.

Somewhat disappointing that it treats the - as a token separator. But it is what it is.

Thanks for the advanced search tips, and telling me which search engine is used. That helps a bit.

1 Like