SmartSearch

Searching by meaning: the query goes through the model's text half (tens of ms) and is compared with every indexed photo and video frame (a flat scan; a few ms per thousand). A video scores as its best-matching frame. The vectors stay in memory between searches and are reloaded only when the index has changed.

Functions

Link copied to clipboard
suspend fun prepare(context: Context)

Loads the text model and the vectors ahead of time (Search opening), so the first query doesn't wait for them. Safe to call often.

Link copied to clipboard
suspend fun rankedAll(context: Context, query: String): List<SmartHit>?

Every item ranked, no cutoff (Search Lab's score curves).

Link copied to clipboard
suspend fun release()

Frees the models and vectors (Smart Search removed, or memory is tight).

Link copied to clipboard
suspend fun search(context: Context, query: String): SmartResult?

Best matches first; empty when nothing clears the bar; null when Smart Search isn't set up. Faces sharpen it (withFaces) when they're downloaded.