pub struct SearchService;Expand description
Search service.
Implementations§
Source§impl SearchService
impl SearchService
Sourcepub const UNIFIED_SEARCH_MAX_PHOTOS: usize = 20_000
pub const UNIFIED_SEARCH_MAX_PHOTOS: usize = 20_000
Upper bound on photos a single legacy (non-paged) unified search returns, and the safety cap the semantic path ranks within. Hard product ceiling for one query. Callers may page below this boundary, but no page can expose or request a result beyond it.
pub fn search( conn: &Connection, query: &SearchQuery, ) -> SqliteResult<Vec<SearchResult>>
pub fn group_by_date(results: Vec<SearchResult>) -> Vec<SearchResultGroup>
Sourcepub fn remember_query(conn: &Connection, query: &str) -> SqliteResult<()>
pub fn remember_query(conn: &Connection, query: &str) -> SqliteResult<()>
Remember a search the user settled on (pressed Enter, opened a result), for the recent list. Typing alone never adds one.
Sourcepub fn recent_queries(
conn: &Connection,
limit: usize,
) -> SqliteResult<Vec<String>>
pub fn recent_queries( conn: &Connection, limit: usize, ) -> SqliteResult<Vec<String>>
The latest remembered searches, newest first.
pub fn clear_recent(conn: &Connection) -> SqliteResult<()>
Sourcepub fn pinned_queries(conn: &Connection) -> SqliteResult<Vec<String>>
pub fn pinned_queries(conn: &Connection) -> SqliteResult<Vec<String>>
Searches the user pinned, in the order they pinned them. Kept in the library, so they travel with it; clearing recent searches keeps them.
Sourcepub fn set_pinned(
conn: &Connection,
query: &str,
pinned: bool,
) -> SqliteResult<()>
pub fn set_pinned( conn: &Connection, query: &str, pinned: bool, ) -> SqliteResult<()>
Pin or unpin a search. Pinning one already pinned changes nothing.
Sourcepub fn search_unified(
conn: &Connection,
raw_query: &str,
) -> SqliteResult<UnifiedSearchResults>
pub fn search_unified( conn: &Connection, raw_query: &str, ) -> SqliteResult<UnifiedSearchResults>
Run a unified multi-entity search.
The query string is parsed once via QueryParser; people/album/place
matches use simple substring LIKE. Photos use the existing
QueryParser-based filter.
Sourcepub fn search_unified_with_semantic(
conn: &Connection,
raw_query: &str,
semantic_photo_ids: Vec<i64>,
) -> SqliteResult<UnifiedSearchResults>
pub fn search_unified_with_semantic( conn: &Connection, raw_query: &str, semantic_photo_ids: Vec<i64>, ) -> SqliteResult<UnifiedSearchResults>
First page (legacy shape: up to 1000 photos) — kept for callers
that have not moved to search_unified_page yet.
Sourcepub fn search_unified_page(
conn: &Connection,
raw_query: &str,
semantic_photo_ids: Vec<i64>,
offset: usize,
limit: usize,
) -> SqliteResult<UnifiedSearchPage>
pub fn search_unified_page( conn: &Connection, raw_query: &str, semantic_photo_ids: Vec<i64>, offset: usize, limit: usize, ) -> SqliteResult<UnifiedSearchPage>
One page of unified results. offset/limit page the photo
list; people/albums/places hits are query-wide and identical on
every page. Ordering is stable (date_taken DESC, id DESC, or
semantic rank first when semantic candidates are supplied), so
concatenated pages never duplicate or skip a photo.
Sourcepub fn search_unified_page_with(
conn: &Connection,
raw_query: &str,
semantic: &mut SemanticLookup<'_>,
offset: usize,
limit: usize,
) -> SqliteResult<UnifiedSearchPage>
pub fn search_unified_page_with( conn: &Connection, raw_query: &str, semantic: &mut SemanticLookup<'_>, offset: usize, limit: usize, ) -> SqliteResult<UnifiedSearchPage>
One page of results, with visual search supplied by the caller:
semantic(text, within) returns the photos that look like text,
best first, only among within when given. It’s asked only about
what the query leaves once people, places, dates and the like are
taken out (never about names), and not at all when nothing is left.
With filters, similarity is scored among the photos that pass them,
so “Dad and Mom food” isn’t limited to the library’s top food photos.
Auto Trait Implementations§
impl Freeze for SearchService
impl RefUnwindSafe for SearchService
impl Send for SearchService
impl Sync for SearchService
impl Unpin for SearchService
impl UnsafeUnpin for SearchService
impl UnwindSafe for SearchService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more