Search problems

MichelleR's Avatar


13 Jul, 2017 12:13 PM

I have noticed problems when searching for text in the Card browser:

I have an extension loaded which allows you to search, while ignoring accents.

What works :
'Ignore Accents' in the search panel :
With 'Ignore Accents' ticked in the search panel, the search correctly ignores accents, and with it not ticked, it doesn't - Correct behaviour

Upper case :
Upper and lower case can be mixed in an English word, and Search will find it - Good behaviour; mix them in a Russian word; and it doesn't work - Bad behaviour

What does not work :
Underline :
If characters are 'Underlined' in the middle of a word, Search does NOT find them - Bad behaviour
Bold :
If characters are 'Bolded' in the middle of a word, Search does NOT find them - Bad behaviour
Colour :
If characters are Coloured in the middle of a word, Search does NOT find them - Bad behaviour

General :
If any formatting other than accents is added in the middle of a word, Search will not find the word - Bad behaviour

My suggestion (searching in all languages) :
Minimum change :
1. Make the search case insensitive in Russian (and presumably, other languages)
2. Remove Underline codes before searching
3. Remove Bold codes before searching

More extensive change :
Remove all formatting codes before searching

A further invaluable change would be stop using non-breaking spaces - their only effect appears to be to mess up formatting on an iPhone screen - you carefully format the text on a PC, and it looks fine, then on a phone it is awful - you have to edit the note on the phone which is IMMENSELY tttttteeeeeeedddddddiiiiiiiooooooouuuuuuussssss!!!!!!!! I have spent tens (maybe hundreds) of hours removing '   in unformatted mode - a sample of the mess is as below - it is NO FUN trying to edit this!!!!!!!
Also, remove all the <span class="Apple-tab-span" style="white-space:pre"> </span> nonsense!

<div><b>быва́ть</b> - to<span class="Apple-tab-span" style="white-space:pre"> </span>be, to be sometimes, to go to see,&nbsp;to&nbsp;visit,&nbsp;to&nbsp;happen,&nbsp;to&nbsp;occur,&nbsp;to&nbsp;be held,&nbsp;to&nbsp;take place</div>Я сейчас <b>прибываю</b>. &nbsp;- &nbsp;I'm <b>arriving</b> now.<div>Том <b>прибыл</b> вчера. &nbsp;- &nbsp;Tom <b>came</b> yesterday.</div><div>Когда они <b>прибудут</b>? &nbsp;- &nbsp;When will they <b>arrive</b>?</div><br /><font color="#8800ba">прилететь</font> ; <font color="#006b5e">приехать</font> - <font color="#8800ba">to fly in</font> ; <font color="#006b5e">to arrive by vehicle</font>

  1. Support Staff 1 Posted by Damien Elmes on 14 Jul, 2017 02:31 AM

    Damien Elmes's Avatar

    Hi Michelle,

    Anki's search functionality does not currently support ignoring accents or formatting outside the sort field due to technical reasons, but it is something I'd like to address in the future.

    The nbsp and Apple-tab-span stuff is a pain - it is a byproduct of WebKit's what-you-see-is-what-you-get editor support. It's possible that changes in the coming 2.1 release will address this - I am still investigating. In the mean time, rather than editing notes individually, you can use Edit>Find&Replace in the browse screen to remove this formatting from all of your notes at once.

  2. 2 Posted by MichelleR on 14 Jul, 2017 03:25 PM

    MichelleR's Avatar

    Hi Damien

    Thank you for your response

    I use an add-on to change nbsp into a space character. This works, but only on a field by field basis, and only on the PC. The formatting problems do not really show on the PC - they only show on the narrower screen of the iPhone. If you edit on the phone, you have to deal with the HTML codes - it's a time-wasting nightmare.

    You can't remove the codes globally because multiple spaces on a card display as a single space, messing up the card formatting in a different way. You need the leave all nbsp-space sequences alone. The addon doesn't do that - it changes all of them.

    I usually add a space at the end of my lines to get around the problem whereby if a line end is formatted, and you add a new line later, the new line will also be formatted (usually not what you want). If you turn this nbsp into a real space, it fails to display in non-HTML mode; adding another character causes the editor to delete the trailing space and continue with the formatting you were trying to stop. It's messy!!

    Selectively trying to remove formatting from parts of a line tends to cause the program to crash.

    I would not dare try that using global replace - too risky

    In reality, editing notes is a hit and miss affair - I have to spend time and effort trying to get around program bugs

    I use Anki a lot (often hours per day), and I try to convince myself that it really is worth all the effort it takes, but the reality is that the program is pretty slow to use, and often haemorrhages time horribly. Partly my fault, I know, for making complicated notes.


    Sent from my iPhone

  3. Support Staff 3 Posted by Damien Elmes on 16 Jul, 2017 01:59 AM

    Damien Elmes's Avatar

    Hi Michelle,

    I understand it is frustrating, and I would have addressed the issue earlier if it were easy to solve :-) For now one thing you might want to consider doing is adding the following to the .card {...} section on your template:

    word-wrap: break-word;

    This will allow the text to wrap even if it contains non-breaking spaces, hopefully saving you the effort of manually editing the text. The downside is that the text may wrap even in the middle of a word.

Comments are closed, but you can start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac