Search
One search box over every deck and card. How to open it, what it matches, how results are ranked, and how to share a search.
Opening search
Search opens over whatever page you’re on:
- the magnifying glass in the header
- Quick search on the home page
- ⌘ K on a Mac or Ctrl K elsewhere, which also closes it again
- /, as long as you’re not typing in a field
It also works on the study screen, from the keyboard. On a phone it slides up as a sheet; on a larger screen it’s a panel near the top. Esc, a click outside, or Cancel on a phone closes it, and focus goes back to where it was.
What it searches
Every deck and card you can study. Anything marked Coming soon is left out.
- Decks: the title, the category (such as HSK 3) and the deck’s hashtags.
- Cards: the term, its other spelling (such as
ka'aifor kāʻai), its reading (such as pinyin), the meaning, the note, and hashtags. Meanings, readings and notes are searched in every answer language a subject offers.
How matching works
Search is forgiving about how you type:
- Case, accents and tone marks don’t matter.
nihao,ni haoandnǐ hǎoall find 你好. - The ʻokina and apostrophes don’t matter, and neither do spaces.
paufinds pāʻū, and so doespa'u. - A meaning with several parts counts each part. “cup, glass” is an exact
match for
glass, and a leading “to” is dropped, so “to love” is an exact match forlove.
Results are ranked by how well they match, best first:
- An exact match, then a match at the start of a word, then a match anywhere inside it.
- For an equal match, the term and its reading rank above the meaning, which ranks above the note and hashtags.
- A result whose whole term or meaning is exactly what you typed, accents
included, gets a small boost. So
leiranks lei above lèi.
Matching words are highlighted in the results.
Results
Results come in two groups, Decks and then Cards, each with a count. The first 5 decks and 30 cards show; Show all and Show more reveal the rest.
- ↑ and ↓ move through the results, and Enter opens one.
- A deck opens its word list.
- A card opens its deck’s word list scrolled to that card, which lights up
for a moment. The link ends in
#card-and the card’s term without accents, such as#card-pauor#card-爱. - A card result shows its meaning in the language you chose for that subject, with a language chip when it falls back to the default.
Filters
Below the search box is a row of chips:
- Subjects. One at a time. Tap it again to clear it.
- Hashtags. The 8 most used, then More tags for the rest. You can pick several. A card must carry every tag you pick.
A hashtag on a deck that none of its cards carry describes the whole deck, so for filtering every card in that deck counts as tagged. With tags picked, deck results show how many of their cards match, such as “6 of 25”.
You can search with filters alone and no text. Hashtag links anywhere on the
site, such as #food on a card, open search with that tag picked.
Links you can share
While search is open, the address bar holds the search, so it can be copied and shared. Any page opened with these parameters opens search prefilled:
| Parameter | Meaning | Example |
|---|---|---|
q | The search text | /?q=rice |
subject | One subject, by its id | /?subject=chinese |
tag | A hashtag; repeat it for more | /?tag=food&tag=verbs |
focus=search | Opens search with nothing in it | /?focus=search |
Closing search takes these parameters back out of the address.
Recent searches
When the box is empty, search shows your last 6 searches, each with its filters. A search is remembered when you open one of its results. Each one has a button to remove it. They’re kept on this device; see Privacy and storage.
Under the hood
The search index is one static file, /search-index.json, built along with the
site. It’s fetched the first time you open search, then kept for the rest of the
visit, so pages don’t load it up front. If it can’t load, search says so and
offers to try again. Search runs entirely in your browser; what you type is
never sent anywhere.