Multiple search items in query do not work

I am trying to ensure that I do an update pass over all my notes (5680) in a particular deck, and update all their content.

I have tried to create a Filtered Deck with the following query: "deck:EO All Official Esperanto Words and Roots" (is:new card:1) (is:new card:2) .

I essentially want to find any note that has both cards new, i.e. any note, for which I have not seen either of its cards. The Note Type is reversible: each note has two cards. Thus I am trying to write a query that says: Card 1 must be new AND Card 2 must be new.

The query above produces no cards. I can see several notes that have both cards new, but the query is not returning them???

I then tried the following query: "deck:EO All Official Esperanto Words and Roots" is:new (card:1 2).

It returns 1262 cards and shows only Card 1 in the Browse window. But this query seems to miss some of the notes that have both cards new, when I look through the list returned by the base query: "deck:EO All Official Esperanto Words and Roots" is:new. It also shows cards, for a note that has one card that is not new.

What is wrong with my query/queries? How do I return Card 1 for all notes that have both cards new?

Many thanks in advance

As far as I understand, searches in Filtered Decks and Card Browser never match notes, but rather they match cards (even when the Browser is in “Notes” mode). So this sort of search string: card:1 card:2 (which is the same as card:1 AND card:2), will never return any result, because no card can be card 1 and card 2 at the same time.

( Also note that (card:1 2) means card:1 AND the text “2”, so it should only match card 1s containing a “2” somewhere )

It’s possible to use tags as a workaround:

  1. First, search only for "deck:EO All Official Esperanto Words and Roots" is:new card:2
  2. Add a tag to all the notes that match this query, like Card2New, for example.
  3. Now search for tag:Card2New card:1 is:new to match all notes where both card 1 and card 2 are new.
  4. You might want to periodically remove the tag, since it won’t update when card 2 stops being new.

Thanks, @jcznk ! That’s what I thought.

Is there no way from a query to drive up to the parent note and then search all its child cards to see whether they are new? The tag thing will work, but it’s manual. I was hoping to have a single query that would perform the work so that I can use it in a Filtered Deck.

Unfortunately, I don’t think this is possible with a single normal query.

The best alternative I can think of is using python (e.g., via add-ons or the debug console). For example, you could have a script that looks for all cards matching given criteria and prints a list of cids, like cid:1611220135653,1611220135663,1611220135660, which then needs to be copy-pasted to a filtered deck.

Thanks! I’ll have to think about a Python script that might suit. Thanks very much for taking the time to think about the problem!