Searching
Anki 的浏览屏幕和筛选牌组功能使用一种常见的方法来搜索特定的卡片/笔记。
Anki's Browse screen and the Filtered Deck feature use a common method of searching for specific cards/notes.
简单搜索
Simple searches
当你在搜索框中键入一些文本时,Anki 会找到匹配的笔记并显示他们的卡片。Anki 在笔记的所有字段中进行搜索,但不搜索标签(有关如何搜索标签,请参阅本节稍后的内容)。一些示例:
When you type some text into the search box, Anki finds matching notes and displays their cards. Anki searches in all fields of the notes, but does not search for tags (see later in this section for how to search for tags). Some examples:
dog
将会匹配 “doggy”,“underdog”等。
search for "dog" - will match words like "doggy" and "underdog" too.
dog cat
查找包含“dog”和“cat”的笔记,如:“raining cats and dogs”。
finds notes that have both "dog" and "cat" on them, such as "raining cats and dogs".
dog or cat
找到包含“dog”或者“cat”的笔记。
finds notes with either "dog" or "cat".
dog (cat or mouse)
查找包含“dog”和“cat”或者包含“dog”和“mouse”的笔记。
finds notes with dog and cat, or dog and mouse.
-cat
查找不包含单词“cat”的笔记。
finds notes without the word "cat".
-cat -mouse
查找既没有“cat”也没有“mouse”的笔记。
finds notes with neither "cat" nor "mouse".
-(cat or mouse)
同上。
same as the above.
"a dog"
查找带有确切字符序列“a dog”的笔记,例如“atta dog“,但不是“dog a”或“adog”。
finds notes with the exact sequence of characters "a dog" on them, such as "atta dog", but not "dog a" or "adog".
-"a dog"
查找不包含词组“a dog”的笔记。
finds notes without the exact phrase "a dog"
d_g
查找包含 d,<1 个字母>,g 的笔记,如:dog, dig, dug 等。
finds notes with d,
<a letter>
, g, like dog, dig, dug, and so on.
d*g
查找包含 d<1 个或 0 个字母>g
的笔记,如:dg, dog, dung 等
finds notes with
d, <zero or more letters>, g
, like dg, dog, dung, etc.
w:dog
在单词边界上搜索“dog”-将匹配“dog“,但不匹配“doggy”或“underdog”。需要 Anki 2.1.24+或 AnkiMobile 2.1.61+。请注意,格式更改可能被解释为单词边界,例如搜索 w:exam 将匹配 example。
search for "dog" on a word boundary - will match "dog", but not "doggy" or "underdog". Requires Anki 2.1.24+ or AnkiMobile 2.1.61+. Note that formatting changes may be interpreted as word boundaries e.g. searching for w:exam will match example.
w:dog*
将匹配“dog”,“doggy”,但不匹配“underdog”。
will match "dog" and "doggy", but not "underdog".
w:*dog
将匹配“dog”,“underdog”,但不匹配“doggy”。
will match "dog" and "underdog", but not "doggy".
需要注意的是:
Things to note from the above:
- 搜索词用空格分隔。
Search terms are separated by spaces.
- 当提供多个搜索词时,Anki 会查找与所有词匹配的笔记——在每个词之间插入一个隐含的“and”。在 Anki 2.1.24+和 AnkiMobile 2.0.60+上,如果你喜欢,你可以明确表示(“dog and cat”与“dog cat”相同),但旧的 Anki 版本会将“and”视为另一个搜索词。
When multiple search terms are provided, Anki looks for notes that match all of the terms - an implicit 'and' is inserted between each term. On Anki 2.1.24+ and AnkiMobile 2.0.60+ you can be explicit if you like ("dog and cat" is the same as "dog cat"), but older Anki versions will treat "and" as just another word to search for.
- 如果只需要匹配其中一个搜索词,则可以使用“or”。
You can use "or" if you only need one of the terms to match.
- 你可以在一个词条前加一个减号来查找不匹配的笔记。
You can prepend a minus sign to a term to find notes that don’t match.
- 你可以将搜索词放在括号中进行分组,如 dog (cat or mouse)示例中所示。这在组合 OR 和 AND 搜索时变得很重要 — 在这个例子中,使用括号,它可以匹配“dog cat”或“dog mouse”,而如果没有括号,它将匹配“dog and cat”或者“mouse”。
You can group search terms by placing them in parentheses, as in the dog (cat or mouse) example. This becomes important when combining OR and AND searches — in the example, with the parentheses, it matches either 'dog cat' or 'dog mouse', whereas without them it would match either 'dog and cat' or 'mouse'.
- Anki 只能在你配置的排序字段中的格式中进行搜索。例如,如果将“example”添加到某个字段中,则在搜索“example“时将不匹配,除非该字段是排序字段。如果一个单词没有格式化,或者在单词中间的格式没有改变,那么 Anki 将能够在任何字段中找到它。
Anki is only able to search within formatting in the sort field you’ve configured. For example, if you add "example" 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.
- 标准搜索对拉丁字符不区分大小写-
a-z
将与A-Z
匹配,反之亦然。其他字符(如西里尔字母)在标准搜索中区分大小写,但可以通过在单词边界或正则表达式(w:
,re:
)上搜索来使其不区分大小写。Standard searches are case insensitive for Latin characters - a-z will match A-Z, and vice versa. Other characters such as Cyrillic are case sensitive in a standard search, but can be made case insensitive by searching on a word boundary or regular expression (
w:
,re:
).
限制于一个字段
Limiting to a field
你也可以要求 Anki 只在特定字段包含某些文本时进行匹配。与上面的搜索不同,默认情况下,字段搜索需要“完全匹配”。
You can also ask Anki to match only if a particular field contains some text. Unlike the searches above, searching on fields requires an 'exact match' by default.
front:dog
查找 Front 字段恰好为“dog”的笔记。写着“a dog”的字段是不匹配的。
find notes with a Front field of exactly "dog". A field that says "a dog" will not match.
"animal front:a dog"
找到“Animal Front”字段正是“a dog”的笔记。双引号是必需的,请参阅下文。
find notes where the "Animal Front" field is exactly "a dog". The double quotes are mandatory, see below.
front:*dog*
找到 Front 字段包含“dog”的笔记。
find notes with Front field containing dog somewhere
front:
找到 Front 字段为空的笔记。
find notes that have an empty Front field
front:_*
找到 Front 字段为非空的笔记。
find notes that have a non-empty Front field
front:*
找到有 Front 字段的笔记,不管 Front 是否为空。
find notes that have a Front field, empty or not
fr*:text
查找有以“fr”开头的字段的笔记。需要 Anki 2.1.24+或 AnkiMobile 2.1.60+。
find notes in a field starting with "fr". Requires Anki 2.1.24+ or AnkiMobile 2.1.60+.
标签牌组卡片和笔记
Tags, decks, cards and notes
tag:animal
查找笔记有“animal”标签,或者子标签像“animal::mammal”。
find notes with the tag "animal", or subtags like "animal::mammal"
tag:none
查找没有标签的笔记。
find notes with no tags
tag:ani*
查找有以 ani 开头标签的笔记。
find notes with tags starting with ani
deck:french
查找 French 牌组,或子牌组例如 “French::Vocab” 牌组的卡片。
find cards in a French deck, or subdecks like French::Vocab
deck:french -deck:french::*
查找 French 的卡片,但不包括其子牌组。
find cards in French, but not subdecks
deck:"french vocab"
搜索牌组名含有空格的写法。
searching when a deck has a space
"deck:french vocab"
同上。
also ok
deck:filtered
只在筛选牌组中搜索。
filtered decks only
-deck:filtered
只在正常牌组中搜索。
normal decks only
card:forward
查找 “Forward” 卡片。
search for Forward cards
card:1
根据模板编号搜索卡片 - 例如,要找到笔记的第二个 Cloze 删除,你可以使用card:2
search for cards by template number - eg, to find the second cloze deletion for a note, you’d use card:2
note:basic
查找使用 基础笔记模板 的卡片。
search for cards with a Basic note type
忽略重音/组合字符
Ignoring accents/combining characters
需要 Anki 2.1.24+或 AnkiMobile 2.0.60+。
Requires Anki 2.1.24+ or AnkiMobile 2.0.60+.
可以使用 nc:
忽略组合字符(“不组合”)。例如:
You can use
nc
: to remove combining characters ("no combining"). For example:
nc:uber
匹配 “uber”, “über”, “Über” 等
matches notes with "uber", "über", "Über" and so on.
nc:は
匹配“は”, “ば”, 和 “ぱ”
matches "は", "ば", and "ぱ"
忽略组合字符的搜索比常规搜索慢。
Searches that ignore combining characters are slower than regular searches.
正则表达式
Regular expressions
Anki 2.1.24+和 AnkiMobile 2.0.60+支持使用“正则表达式”在笔记中搜索,这是一种标准而强大的文本搜索方式。
Anki 2.1.24+ and AnkiMobile 2.0.60+ support searching in notes with "regular expressions", a standard and powerful way of searching in text.
使用 re:
开始搜索,以按正则表达式进行搜索。为了让事情变得更容易,Anki 将把以下内容作为原始输入,所以请记住这里列出的规则。
Start a search with
re:
to search by regular expression. To make things easier, Anki will treat the following as raw input, so bear in mind the rules listed there.
一些例子:
Some examples:
"re:(some|another).*thing"
查找 有“some”或“other”,后跟 0 个或多个字符,然后是“thing”的笔记。
find notes that have "some" or "another" on them, followed by 0 or more characters, and then "thing"
re:\d{3}
find notes that have 3 digits in a row
Regular expressions can also be limited to a specific field. Please note that unlike the normal searches in a specific field, regular expressions in fields don't require an exact match. Eg:
front:re:[a-c]1
matches uppercase or lowercase a1, B1 or c1 that occurs anywhere in the "Front" field
front:re:^[a-c]1$
like the above, but will not match if any other text falls before or after a1/b1/c1.
Anki 2.1.50 添加了对标记的 regex 支持:
Anki 2.1.50 added regex support for tags:
tag:re:^parent$
查找具有确切标记“parent”的笔记,忽略任何子标记(如“parent::child”)
find notes with the exact tag "parent", disregarding any child tags like "parent::child"
"tag:re:lesson-(1[7-9]|2[0-5])"
find notes with tags "lesson-17" through "lesson-25"
你可以在此处了解有关正则表达式的更多信息:https://regexone.com/lesson/introduction_abcs
You can learn more about regular expressions here: https://regexone.com/lesson/introduction_abcs
需要注意的一些事项:
Some things to be aware of:
- 默认情况下,搜索不区分大小写;在开始时使用(
?-i
)可启用区分大小写功能。The search is case-insensitive by default; use (
?-i
) at the start to turn on case sensitivity. - 一些文本(如空格和换行符)在 HTML 中的表示方式可能不同——你可以在编辑屏幕中使用 HTML 编辑器来查看底层 HTML 内容。
Some text like spaces and newlines may be represented differently in HTML - you can use the HTML editor in the editing screen to see the underlying HTML contents.
- 有关 Anki 的 regex 支持的详细信息,请参阅 regex-crate 文档:https://docs.rs/regex/1.3.9/regex/#syntax
For the specifics of Anki's regex support, please see the regex crate documentation: https://docs.rs/regex/1.3.9/regex/#syntax
卡片状态
Card state
is:due
待学习的复习卡和学习卡。
review cards and learning cards waiting to be studied
is:new
新卡片。
new cards
is:learn
正在学习的卡片。
cards in learning
is:review
复习卡片(到期和未到期)和遗忘卡片。
reviews (both due and not due) and lapsed cards
is:suspended
手动暂停的卡片。
cards that have been manually suspended
is:buried
已被自动或手动搁置的卡片。
cards that have been buried, either automatically or manually
请注意,有了新的排程算法,Anki 现在可以区分手动和自搁置卡片,这样你就可以取消搁置其中一种。
Note that with the new scheduler, Anki now distinguishes between manually and automatically buried cards so you can unbury one set without the other.
遗忘的卡片分为以下几类,因此将它们组合起来以获得更精确的结果可能会很有用:
Cards that have lapsed fall into several of these categories, so it may be useful to combine them to get more precise results:
is:learn is:review
已遗忘并等待重新学习的卡片。
cards that have lapsed and are awaiting relearning
-is:learn is:review
复习卡片,但不包括遗忘卡片。
review cards, not including lapsed cards
is:learn -is:review
第一次学习的卡片。
cards that are in learning for the first time
flag:1
红色旗帜的卡片
flag:2
橙色旗帜的卡片
flag:3
绿色旗帜的卡片
flag:4
蓝色旗帜的卡片
flag:5
粉色旗帜的卡片
flag:6
青色旗帜的卡片
flag:7
紫色旗帜的卡片
卡片属性
Card properties
prop:ivl>=10
卡片间隔大于 1 等于 0 天
cards with interval of 10 days or more
prop:due=1
卡片明天到期
cards due tomorrow
prop:due=-1
昨天到期但没有被回答过。
cards due yesterday that haven’t been answered yet
prop:due>-1 prop:due<1
卡片到期时间在昨天和明天之间。
cards due between yesterday and tomorrow
prop:reps<10
卡片被回答小于 10 次。
cards that have been answered less than 10 times
prop:lapses>3
卡片被移到正在学习次数大于 3 次。
cards that have moved into relearning more than 3 times
prop:ease!=2.5
比默认更简单或更困难。
cards easier or harder than default
prop:cdn:d>5
(Requires Anki 2.1.64+.) cards with the value of d
in custom data (usually refers to Difficulty in FSRS) greater than 5
prop:cds:v=reschedule
(Requires Anki 23.10+.) cards with the string v in custom data equal to reschedule
prop:s>21
(Requires Anki 23.10+ and FSRS enabled.) cards with stability greater than 21 days
prop:d>0.3
(Requires Anki 23.10+ and FSRS enabled.) cards with difficulty greater than 0.3
prop:r<0.9
(Requires Anki 23.10+ and FSRS enabled.) cards with retention less than 0.9
最近事件
Recent Events
已添加的
Added
added:1
今天添加的卡片。
cards added today
added:7
上周添加的卡片。
cards added in last week
检查是根据卡片创建时间而不是笔记创建时间进行的,因此即使在很久以前添加了笔记,也会包括在时间范围内生成的卡片。
The check is made against card creation time rather than note creation time, so cards that were generated within the time frame will be included even if their notes were added a long time ago.
已编辑的
Edited
edited:n
在过去 n 天内添加/编辑笔记文本的卡片。
cards where the note text was added/edited in the last n days.
这需要 Anki 2.1.28+/AnkiMobile 2.0.64+。
This requires Anki 2.1.28+ / AnkiMobile 2.0.64+.
已回答的
Answered
rated:1
今天已回答的卡片。
cards answered today
rated:1:2
今天被回答为“困难(2)”的卡片。
cards answered Hard (2) today
rated:7:1
过去 7 天回答“重来(1)”的卡片。
cards answered Again (1) over the last 7 days
rated:31:4
上个月回答“简单(4)”的卡片。
cards answered Easy (4) in the last month
在 2.1.39 版本之前,评级搜索被限制在 31 天内。
Rating searches had been limited to 31 days before version 2.1.39.
第一次被回答
First Answered
在 2.1.45+版本上,你也可以只搜索第一次复习:
On version 2.1.45+, you can also search for the very first review only:
introduced:1
今天第一次被回答的卡片。
cards answered for the first time today
introduced:365
过去 365 天内首次应答的卡片。
cards answered for the first time within the last 365 days
匹配特殊字符
Matching special characters
本节是为 Anki 2.1.36+编写的,早期版本在某些情况下不支持转义字符。
This section was written for Anki 2.1.36+ - earlier versions did not support escaping characters in certain situations.
如前一节所示,一些字符,如 *
、 _
和 "
在 Anki 中有特殊含义。如果你需要在搜索中找到这些字符,你需要告诉 Anki 不要特别对待它们。
As shown in the previous section, some characters like
*
,_
and"
have a special meaning in Anki. If you need to locate those characters in a search, you need to tell Anki not to treat them specially.
- 空格: 要匹配包含空格的内容,请将“整个搜索次”用双引号括起来。如果是冒号搜索,你还可以选择只引用部分:“在冒号之后”(除非冒号之前也有空格)。
Space: To match something including spaces, enclose the "entire term" in double quotes. If it is a colon search, you also have the option to only quote the part:"after the colon" (unless there are spaces before the colon as well).
"
、*
、_
:在这些字符之前添加一个反斜杠,以便按字面意思处理它们。例如,_
将匹配任何单个字符,但\_
只匹配实际的下划线。"
,*
and_
: Add a backslash before these characters to treat them literally. For example,_
will match any single character, but_
matches only an actual underscore.\
: 因为反斜杠是用来去除其他字符的特殊含义的,所以它也被特殊处理。如果需要搜索实际的反斜杠,请使用\\
而不是\
。\
: Because a backlash is used to remove the special meaning from other characters, it too is treated specially. If you need to search for an actual backslash, use\\
instead of\
.(
和)
:你可以通过将整个搜索词括在引号中和/
或使用反斜杠来搜索括号。也就是说,some(text)
、some\(text\)
和some\(text\)
都是等价的,但some(text)
不是。(
and)
: You can search for parentheses either by enclosing the full term in quotes, and/or by using a backslash. That is,some(text)
,some\(text\)
andsome\(text\)
are all equivalent, but some(text) is not.-
:以-
开头的搜索词通常会反过来:-dog
匹配除 dog 之外的所有内容。如果你希望包含一个实际的连字符,可以使用反斜杠,也可以将文本包含在引号中,例如\-.-
或"-.-"
。-
: Starting a search term with-
usually inverts it:-dog
matches everything except dog for example. If you instead wish to include an actual hyphen, you can either use a backslash, or include the text in quotes, such as\-.-
or"-.-"
.:
:冒号必须转义,除非它们前面有另一个未转义的冒号。因此,w:e:b
是对e:b
的单词边界搜索,w\:e\:b
从字面上搜索w:e:b
,w\:e:b
在字段w:e
中搜索b
(请参阅字段搜索)。:
: Colons have to be escaped unless they are preceded by another, unescaped colon. Sow:e:b
is a word boundary search fore:b
,w\:e\:b
searches literally forw:e:b
andw\:e:b
searches the fieldw:e
forb
(see field searches).&
、<
、 和>
:&
、<
和>
在 Anki 中搜索时被视为 HTML,因此包含它们的搜索无法按预期工作。但是,你可以使用它们对应的 HTML 实体名称(&
用于&
、<
用于<
和>
用于>
)来搜索它们。例如,搜索<&text>
在字段中搜索带有<&text>
的卡片。&
,<
, and>
:&
,<
, and>
are treated as HTML when searching in Anki, and as such searches containing them don't work as expected. However, you can search for them by using their corresponding HTML entity names (&
for&
,<
for<
, and>
for>
). For example, searching<&text>
searches for a card with<&text>
in a field.
原始输入
Raw input
以某些关键字(如 re:
)开头的文本将被视为原始输入。也就是说,上面列出的字符在很大程度上失去了它们的特殊含义。在这种情况下,只需要最少的转义就可以防止歧义:
Text preceded by certain keywords (like re:) will be treated as raw input. That is, the characters listed above largely lose their special meaning. In such a context, only a minimum of escaping is required to prevent ambiguity:
"
必须避开。"
must be escaped.- 空格和特殊字符要求引用搜索词。
Spaces and unescaped parentheses require the search term to be quoted.
- 搜索项不能以奇数个反斜杠结尾。
The search term must not end in an odd number of backslashes.
对象 ID
Object IDs
nid:123
笔记 id 为 123 的笔记。
the note with note id 123
cid:123,456,789
卡片 id 是 123,456 或 789
all cards with card ids 123, 456 or 789
可以在浏览器的卡信息对话框中找到笔记和卡 ID。当进行附加组件开发或以其他方式与数据库密切合作时,这些搜索也可能很有帮助。
Note and card IDs can be found in the card info dialog in the browser. These searches may also be helpful when doing add-on development or otherwise working closely with the database.