# Incorrect Browser Search Results?

**URL:** <https://forums.ankiweb.net/t/incorrect-browser-search-results/19156>\
**Category:** Help\
**Created:** [April 17, 2022, 3:02am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156 "2022-04-17T03:02:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackace72](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@blackace72](https://forums.ankiweb.net/u/blackace72)\
**Post date:** [April 17, 2022, 3:02am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/1 "2022-04-17T03:02:46Z")

</div>

## Environment Info

```
Anki 2.1.50 (c96ef8cd) Python 3.9.7 Qt 6.2.3 PyQt 6.2.3
Platform: Mac 12.0.1
Flags: frz=True ao=False sv=3
Add-ons, last update check: 2022-04-15 20:17:52

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
BetterSearch ['1052724801', 2022-01-25T17:25, 'None', '']
Field AutoComplete ['511710206', 2022-04-15T07:02, 'None', mod]
Markdown Support - With Batch n Preview Updated ['1259478414', 2022-02-04T05:39, 'None', '']
Quick Field Navigation ['734297936', 2019-12-29T21:24, 'None', '']
True Retention ['613684242', 2017-11-19T15:43, 'None', '']
link Cards Notes and Preview them in extra window ['1423933177', 2021-12-07T10:51, 'None', '']

===IDs of active AnkiWeb add-ons===
1052724801 1259478414 1423933177 511710206 613684242 734297936

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Add Hyperlink ['318752047', 2022-02-08T18:21, 'None', '']
Advanced Browser ['874215009', 2022-01-30T18:07, 'None', '']
AnkiWebView Inspector ['31746032', 2022-04-08T15:44, 'None', '']
Batch Editing ['291119185', 2019-06-02T14:47, 'None', '']
Cloze Overlapper for Anki 21 ['109531687', 2021-01-11T22:12, 'None', '']
Customize Keyboard Shortcuts ['24411424', 2021-12-05T15:39, 'None', '']
Fastbar- with nightmode support ['46611790', 2022-04-14T23:04, 'None', '']
Field History ['1247884413', 2019-01-08T13:34, 'None', '']
Image Occlusion Enhanced for Anki 21 ['1374772155', 2022-04-09T03:15, 'None', '']
Markdown and KaTeX Support ['1087328706', 2022-02-10T11:44, 'None', '']
Mini Format Pack ['295889520', 2018-07-24T13:45, 'None', '']
More Overview Stats 21 ['738807903', 2021-07-30T15:13, 'None', '']
Searching PDF Reading Note-Taking in Add Dialog ['1781298089', 2021-09-17T06:24, 'None', mod]
Symbols As You Type ['2040501954', 2021-03-21T22:17, 'None', '']
Syntax Highlighting for Code ['1463041493', 2018-10-06T21:31, 'None', '']
Ze Add Note Id ['886709118', 2021-03-02T15:06, 'None', '']
Ze Frozen Fields ['94610912', 2021-02-11T19:06, 'None', '']
extended editor for field for tables searchreplace ['805891399', 2022-03-13T06:51, 'None', '']

```

## Problem

Browser returns unexpected search results. Specifically, the query: `w:tin` returns a card that has string `glutin-is` and `glutinis`, but doesn’t contain exact string `tin`. As per the manual, `w:dog` will search for `dog` but will NOT search for `doggy` or `underdog`, so this should be analogous.

I also tried `re:\btin\b` but it shows the same results (pretty sure that’s to be expected)

## Example

This card shows with search query `w:tin`

 ![gluten glutinis](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/9/997573223655b3904b0a901d31b3c3421b05eab1.png)

(Note fields):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/2/298559768e47c45117d58c2c30b122bc3d9b1611.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/9/91f62d13d7c13e61ff8b29f69083cdf4425ac660.png)

## Expected result

Show cards with string `tin` as distinct word, and exclude cards that don’t search for distinct word `tin`

## Actual result:

Shows cards without `tin` as a distinct word, but instead shows cards with `tin` anywhere within a string (like `glutin` and `glutin-is`)

## Slight clarification

I still get cards that have only `tin` string only as well, but also incorrectly get cards that can have `tin` anywhere within, ex.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/6/68113dba1e9901bb0d23934378b362695bc85545.png)

(note fields)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/7/74cbc8329b2dd423c087a031171ce497a112cff1.png)

---

<div class="post-metadata">

**Author:** ![roxgib](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/roxgib/32/9238_2.png) [@roxgib](https://forums.ankiweb.net/u/roxgib)\
**Post date:** [April 17, 2022, 4:08am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/2 "2022-04-17T04:08:50Z")

</div>

Try it with Better Search disabled (or preferably with all add-ons disabled).

Make sure there’s no space before tin.

Check the formatting of the sort field, sometimes there’s some cruft in there.

---

<div class="post-metadata">

**Author:** ![blackace72](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@blackace72](https://forums.ankiweb.net/u/blackace72)\
**Post date:** [April 17, 2022, 4:36am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/3 "2022-04-17T04:36:40Z")

</div>

I did start up Anki without add-ons by holding `Shift`, but for some reason the copy debug still says it’s activated (I think I’ve read this before).

There are no spaces before tin (in the search bar)

I tried checking the format of the sorting field, but for some reason clicking on different note types makes the HTML editor not open/freeze, and there’s like some memory leak that makes fields of some notes “leak” onto the fields of other notes, so the fields and formatting are wrong (could be a reason why the search doesn’t work? Or maybe it’s just purely visual glitch)

---

<div class="post-metadata">

**Author:** ![blackace72](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@blackace72](https://forums.ankiweb.net/u/blackace72)\
**Post date:** [April 17, 2022, 5:24am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/4 "2022-04-17T05:24:01Z")

</div>

## Solution

After updating to 2.1.51RC1 the HTML editor works/doesn’t leak when navigating, so I was able to check the HTML editor of the sort field.

I realized that the sort field wasn’t necessarily the problem, since Anki will search all fields. So I checked the HTML editor of the different fields of cards.

**Long story short** :  
`w:tin` must be equivalent to the RegEx expression: `/\btin\b/`  
this means that Anki is looking for `tin` , as long as it isn’t before or after any of these characters:

1. lowercase a-z
2. uppercase A-Z
3. any digit 0-9
4. an underscore `_`

After looking at HTML editor, the card’s underlying HTML has:

```html
gl<b>u</b>tin-is

```

i.e. it is valid (and this was the case with all similar cases)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/3/34c66cee9b216521b04376b439d502b62658410f.png)

**The real problem is that the manual is slightly misleading for this syntax** , since it will include “gl **u** tin-s”, even though it suggests it wouldn’t. Maybe put an asterisk on that part, and explain that it reads HTML, so formatting can possibly negate this? @dae (sorry to ping)

---

<div class="post-metadata">

**Author:** ![roxgib](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/roxgib/32/9238_2.png) [@roxgib](https://forums.ankiweb.net/u/roxgib)\
**Post date:** [April 17, 2022, 6:05am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/5 "2022-04-17T06:05:48Z")

</div>

> `gl<b>u</b>tin-is`

Good catch!

The manual does mention something tangentially related to this…

> Anki is only able to search within formatting in the [sort field](https://docs.ankiweb.net/editing.html#customizing-fields) you’ve configured. For example, if you add " **exa** mple" to one of your fields, this will not be matched when searching for “example” unless that field is the sort field. If a word is not formatted, or the formatting does not change in the middle of the word, then Anki will be able to find it in any field.

…but that doesn’t make it clear that the reverse is also true. I’ve [suggested a change](https://github.com/ankitects/anki-manual/pull/111) to warn users about this. Of course ideally it would be possible to ignore formatting when searching.

> [@blackace72](#):
>
> there’s like some memory leak that makes fields of some notes “leak” onto the fields of other notes

Are you sure you’re using the release version of 2.1.50, and not one of the betas? This issue was occurring with 2.1.50 RC3.

---

<div class="post-metadata">

**Author:** ![blackace72](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@blackace72](https://forums.ankiweb.net/u/blackace72)\
**Post date:** [April 17, 2022, 6:17am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/6 "2022-04-17T06:17:41Z")

</div>

Ahh I guess based on the build number `c96ef8cd` I was using RC3, didn’t even realize haha! Thanks for the info, and getting the word out

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 4:25am UTC](https://forums.ankiweb.net/t/incorrect-browser-search-results/19156/7 "2023-05-01T04:25:04Z")

</div>


