Anki Forums

Anki 2.1 Desktop: Searching with * only when limited to a field

I have been wondering why search with a truncation mark only works when the search is limited to a field.

Example:
virtulikone -> no result
s:virtu
likone -> found (the name of the field is “s”, the word found is “virtuaalikone”)

Same behaviour regardless of the position of the asterisk (e.g. at the end of the search string).

This behaviour doesn’t seem to fit with the Anki manual. I also feel like it hasn’t always been like this. I don’t recall having to limit the search to a field for the asterisk to work.

Version 2.1.26 (70784154)
Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Windows 10

(I can’t update to a newer version because the JS in my note type won’t work or at least I got HTML errors that do not occure in the current version.)

Works for me on 2.1.22.
Maybe this is related to the last bullet point of Simple searches?

I didn’t realize that the asterisks in my example cause italic font and do not display, sorry. Here the example (since I don’t seem to be able to edit anymore):

virtu*likone -> no result
s:virtu*likone -> found (the name of the field is “s”, the word found is “virtuaalikone”)

The search documentation says that the following should work:
d*g
finds notes with d, , g, like dg, dog, dung, etc.

My fields are formatted (they are inside a div with an id via which font colour ist changed) but not in any way the formatting would change inside a word. The word gets found regardless of what field it is in (i.e. not necessarily sorting field), if (and only if) I put the field name in front:
s:virtu*likone, esim:virtu*likone, … all works.
virtu*likone however finds nothing.

Maybe I need to downgrade to 2.1.22?

1 Like

All right, I just tested it on 2.1.34 and can confirm the behaviour you’re describing.
The asterisk is not treated as a wildcard in “no-colon” searches anymore, it is matched literally. This was probably introduced with 2.1.24 where there were some changes to the search code. Since this isn’t reflected in the docs, I guess it’s a bug, @dae?

By the way, I’m just on 2.1.22 for an add-on. There are no other reasons to downgrade in my opinion. In your case, you can still achieve the intended search behaviour with *:virtu*likone. This is certainly less effort than downgrading. :grin:

1 Like

Thanks! And thanks for the generic search string suggestion. I search Anki all the time though, it is definitely less effort to downgrade than to always add the asterisk colon :slight_smile:

Thanks for the report; should be fixed in the next update.

1 Like