Search not working: "added:" returns more results than expected

Howdy y’all,

I’m running Anki Desktop version 2.1.54 (b6a7760c)⁩ on macOS. With this version I’ve found that searches with added: are giving more results than they should. For example, my search

deck:Mandarin added:1

should only return the 4 notes that I added today. But instead it returns 214 notes, many of them added months ago.

I have some add-ons that interact with the Anki browser, namely Advanced Browser and BetterSearch. But even when I disable them, the behavior persists.

By contrast, if I try the search

deck:Mandarin is:new

then I only get the 4 notes I added today.

Does anyone have any insight into what could be going on? Did I miss some change to the format for search queries in this version?

Actually, it turns out I get the same results doing the same search for added:1 on Anki for iOS. I don’t quite understand this behavior.

Any help would be greatly appreciated.

Peace out,
Todd

Probably related: Issue with huge card IDs

3 Likes

Wow, thanks @abdo . That’s a perspective I totally didn’t see coming!

Evidently, even after many years using Anki, I’m still a noob, so let me ask: How do I see the Card IDs?

I’ve managed (with the Advanced Browser add-on) to check the Created Date and Created Time for the notes that appear in my added:1 (or, today, added:2) searches, but the dates and times seem correct and distinct: 129 from March, 81 from May, and 4 from (now) yesterday. Moreover, I’d been able to use searches like added:1 with those cards from March and May before this version. From the thread you mention, I can understand how I still might not be seeing the IDs themselves, which might cause problems. But I’m not sure why I’m only seeing this behavior now, and not earlier with the other cards that come up in this search.

… time passes …

I tried to export the cards that come up in this added search, and I got an error message that the deck I was trying to create had “time stamps in the future”, and that I should ask how to fix this. So I guess you might be right after all!

But I’m not sure why, if the cards seem to have proper date and time stamps:

So I didn’t quite follow how the discussion in that other thread would apply here.

Thanks so much for the input. This is incredibly helpful.

Peace out,
Todd

The discussion is from some releases ago, and even if it’s the same problem, it may have looked very different back then. If I were you, I’d just make a backup and give the linked add-on a try.

2 Likes

Howdy y’all,

Great suggestion, @Rumo . Way to cut to the chase! Especially since, looking at the package information, it describes the problem right there.

I tried it. Unfortunately, it didn’t change anything. I still get the same 214 cards, instead of 4, for my added: search.

Any other suggestions?

I’ve exported the cards that come up for deck:Mandarin added:2 as an Anki package and as a text file in this folder in Box, in case anyone might be able to see the problem by looking at those.

Peace out,
t

I believe it did change something: You are now able to export the deck without errors, right?

The cards still coming up when searching for added:1 is actually expected. What the add-on does is just fix the huge future card IDs to prevent errors and crashes. It modifies the timestamps (i.e. card IDs) of the offending cards to look like they are created at the time of running the add-on, so that all IDs are in the past as expected. The add-on can’t restore the original true creation dates of the cards.

2 Likes

Howdy @abdo ,

Sorry, you’re totally right. It fixed the problem of the export, which I hadn’t thought was my problem; but you rightly point out that it was, in a sense.

I guess I was thrown off by the fact that these cards still have a Created Date and Created Time attached to them that are correct, but yet this isn’t the data accessed when doing an added: search. That’s of course not a problem with your add-on. I suppose it’s just a feature of the added: functionality I didn’t expect: it’s not looking at the actual date these cards were added (which still shows correctly and distinctly), but rather at Card IDs and inferring the date from there?

Thanks for the help.

Peace out,
t

The card id is the creation time of a card. That’s why huge ids cause issues: They don’t resolve to a reasonable point in time.
Vanilla Anki doesn’t show card creation times. Maybe you’re looking at the note creation or card modification columns? I think Advanced Browser does have a column for them, though, and it should align with the added search.

1 Like

Howdy @Rumo ,

Thanks. Yes, I’m starting to see that now. My apologies for not realizing that earlier.

I guess what’s kept me a little confused is the data displayed in the browser. For example, there’s what I saw before running the add-on @abdo pointed to:

In the Created Date (Card) and Created Time (Note) columns, you can see what are essentially the correct calendar dates and times for creation of those cards and notes, even though I was already experiencing the problem based on the Card IDs. And if I look today, after having run the add-on, I see this:

That still maintains distinct and correct calendar dates and times in those same two columns.

But after having run the add-on, if I switch to the “card view” in the browser, I get this:

I can see that this confirms what @abdo was saying about the add-on re-stamping the cards with an ID (and, as you’re pointing out, a date and time) that marks when the add-on was run (because it doesn’t know what happened before).

So I can see that Card IDs were the problem, Card IDs are linked to dates and times, and @abdo 's add-on fixed Card ID problems. But I guess I still have some work to do to understand why, during this whole time, the browser is showing me in one view that those cards had and still have their correct creation dates and times… in some bit of data that the browser was looking at.

I don’t mean to be obtuse. I’m just trying to understand what the browser is seeing, which looks correct, and yet added: searches don’t see that.

Thanks for all your assistance and patience.

Peace out,
t

If card creation dates / times show correctly in the Advanced Browser’s column, then I don’t see how there could be a problem with the card ids and the id fix add-on should leave them alone.

Two problems with your screenshots:

  1. The 3rd one shows different notes and cards, as can be seen by the sort fields.
  2. The 1st two are in notes mode, so the shown card creation dates are only those of each note’s first card. If these cards have siblings with invalid ids, they would not be visible, but still cause the note to appear for added:3.

Howdy @Rumo ,

Great points.

The 3rd one shows different notes and cards, as can be seen by the sort fields.

That’s only due to my not moving to the bottom of the browser window like I did in the other photos. In the other photos, I was trying to focus on the cards that I had created in the last day or two. For the last image, all the dates were the same, so it didn’t seem necessary.

The 1st two are in notes mode, so the shown card creation dates are only those of each note’s first card. If these cards have siblings with invalid ids, they would not be visible, but still cause the note to appear for added:3.

I think that’s perhaps the critical point. All of the note types affected have multiple cards. And it seems like, when I switch from Notes view to Cards view, only some of the affected cards are there… not all the ones corresponding to a given note.

So I think you’re right that the problem seems to affect other cards associated with a note after that first card is created. I’m not sure I understand why that would happen to some cards in a note and not others (so I’m a little trepidatious about creating several cards for a single note going forward), but I think that’s an excellent insight. Thanks!

Peace out,
t

Me neither, but I wouldn’t worry about notes with multiple cards going forward. As long as you’ve stopped using the third-party tool that created the issue in the first place and have fixed all ids, Anki won’t generate any more bad ids.

1 Like

Let’s hope so. I’m not even sure what add-on caused the problem. But hopefully my periodic pruning of add-ons got rid of it anyway. :stuck_out_tongue:

Thanks again for all the help!

Peace out,
t

1 Like