Skip to main content

search

Function search 

Source
pub async fn search(
    pool: &PgPool,
    actor: &Actor,
    filter: &ItemFilter,
    page: Page,
) -> AppResult<(Vec<ItemSummary>, i64)>
Expand description

Searches items the actor may read; every row carries its latest revision.

The latest revision of an item is looked up per item, so the query never does that for the whole vault: a search text, a state, a CAD program or an attribute condition first narrows the items to candidates found set-based (any revision matches – a superset, the exact conditions on the latest revision are checked afterwards), and the total comes from the same query (COUNT(*) OVER ()). Without such a filter only the requested page of items (by number) is looked up, and the total is a plain count.