Expand description
Views: the mechanism behind an app’s designed views and its search.
A view is a query over the app’s resources plus a layout. The app’s designed views (a library, a page per album) are crafted and fixed; this module is what they stand on, never something people configure:
- Resource types (
KindDecl): each type’s fields, the role a field plays where an item is shown (FieldRole), which fields typed text finds and which narrow by a chip (FilterKind), and how its items are presented in a list of results (Form). Every place an item appears renders through the app’s presentation of its type, so a search result is the same song as in the library. - A view stack per window (
ViewStack): back and forward always work, and returning to a view restores where the person was in it (ViewPlace). - Search is a view. Typing into the window bar’s search field turns
the window’s view into a query view of the app’s resources
(
QuerySpec): results grouped by type, chips under the field from the filterable fields (facet_offers,facet_bar), typed tokens (artist:ada) mapped onto the same chips, and the app’s actions that match in a trailing “In this app” group as their real controls (action_hits,actions_group). Escape or Back returns to the view before, exactly. - The query (
QueryEngine): local items answered from an index in the frame of the keystroke; remote sources (RemoteSource) streamed into their own sections below, with cancellation, a cache by query, reuse of an earlier answer while a refined query is on the way, and rows that never move under the person’s pointer or keyboard. An app whose search already has entries hands those over (Item::from_entry): one search model feeds the platform search and the app’s query view, and a match inside an entry’s prose is a hit at its passage. - Keeping (
KeptViews): any query view can be kept, and then sits beside the designed views as the person’s own.
Structs§
- Action
Hit - An action that matches a query, as the control it is.
- Cancel
- Asked by a running request whether it should stop: a newer query took its place.
- Chip
- One chip: the filterable field it narrows by, and the value for a value chip (none for a toggle that is on).
- Control
Decl - Facet
Menu - The values of one value filter, opened over its chip: each with how many results share it and a check on those chosen, since any number may be. Choosing one toggles it in the query; the menu closes, and opening it again chooses another. An app that paints its own surface owns one, draws it over its page and routes events to it while it is open.
- Facet
Offer - The chip of one filterable field.
- Facet
Value - One value a value filter offers.
- Field
Decl - One field of a resource type.
- Item
- One item of a resource type, as search and views read it: its type, its
id, and its fields by key. A field may hold several values (a song by two
artists). A remote source attaches what it fetched (
payload), so the app can make the item playable or openable before anything is stored. - Kept
View - One kept query view.
- Kept
Views - The query views a person kept in one app, oldest first.
- Kind
Decl - One resource type of an app: what its items are called, how they are presented in results, and their fields.
- Query
Engine - The query of one query view: its local index, its remote sources, and what it has found so far.
- Query
Results - What a query has found so far.
- Query
Spec - What a query view asks for.
- Query
Timings - How long a query took to show its results, from the moment it was set.
- Remote
Error - Why a remote source could not answer, as its section says it.
- Remote
Section - What one remote source has found for the query.
- Result
Group - The items of one type in a list of results, best first.
- View
Entry - A view the stack holds and where the person was in it.
- View
Place - Where a person was in a view: what a return to it restores.
- View
Stack - The views of one window: the one shown, the ones Back returns to and the ones Forward goes on to.
Enums§
- Control
Kind - How an action looks as a control.
- Field
Role - The part a field plays where an item of its type is shown.
- Filter
Kind - How a filterable field narrows results, which decides the chip it gets.
- Form
- How a type’s items are presented in a list of results.
Constants§
- FRESH
- How long a remote answer is shown from the cache without asking again.
- GROUP_
LIMIT - How many items one group of results shows.
- THROTTLE
- The least time between two requests to one remote source while the person types. A query typed within it goes out when it has passed.
Traits§
- Local
Source - An index of the app’s own that answers with the local items, in the same frame: matches in what this device does not hold yet, such as a library’s synced index of books whose text is elsewhere. It answers on the UI thread, so within the frame’s budget.
- Remote
Source - A source of items that are not local: a streaming catalogue, a store, a collaborator’s library. It keeps its own index; nothing of it is downloaded to be searched.
Functions§
- action_
control - The control
hitis, bound to its action throughactions; an action the resource no longer publishes shows disabled. - action_
hits - The actions of
specsthat matchquery, best first, at mostlimit: each as its declaration incontrolssays, a button where none does. Only actions a control can run are listed: those asking for nothing more, and those whose declared control asks for it. - actions_
group - The trailing “In this app” group of a query view: its heading, then each
hit as its real control, with a button that takes the person to where the
control lives (
show, given the control’s home) for those that have one.headingandshow_labelare the app’s words for them. - excerpt
- The part of
passagearound the first word ofqueryit holds, the match in its middle, cut at word boundaries and marked where it was cut: what a hit inside prose shows of it. - facet_
bar - The chips as a row: a toggle flips, a value filter’s chip opens its
values (
open), and an active chip’s clear control handson_changethe query without its choice. - facet_
offers - The chips for
queryand what it found: one per filterable field ofkinds, in declaration order, each value counted amongresults. - filters
- The filterable fields of
kinds, each key once, in declaration order: the chips a query view offers.
Type Aliases§
- Open
Facet - What a press on a chip asks of the app: a value filter’s chip opens its
list of values, the app showing it where it suits (
key).