Skip to content

feat(search): semantic image search with CLIP embeddings - #3316

Draft
dschmidt wants to merge 1 commit into
refactor/search-mappingfrom
feat/semantic-image-search
Draft

feat(search): semantic image search with CLIP embeddings#3316
dschmidt wants to merge 1 commit into
refactor/search-mappingfrom
feat/semantic-image-search

Conversation

@dschmidt

@dschmidt dschmidt commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Semantic image search: semantic:"dog on a beach" finds images by content, no tags needed, any language the model covers.

Indexing: a ClipExtractor decorator (around basic/tika) embeds images via a CLIP inference service (immich machine-learning API). Querying: the clause text is embedded into the same space and images are ranked by cosine similarity, bleve via faiss KNN behind the new vectors build tag, OpenSearch via knn_vector. The clause is split off the parsed KQL tree and composes with the rest of the query: the filter part scopes the neighbor search and owns the totals, hybrid rankings fuse via RRF, purely semantic queries return just the ranking. Vector size is index schema (512, startup probe hard-fails on mismatch); in bleve the raw vector lives in a stored-only sibling field so it survives move/delete/restore.

Enable with SEARCH_EXTRACTOR_CLIP_URL; bleve needs a build with ENABLE_VECTORS=true (faiss stage in Dockerfile.multiarch); existing content needs a force reindex.

Open: configurable dims/model, originals vs thumbnails to the service, capability flag for clients, web search bar wraps input as name:"*...*", OR/NOT position degrades to AND, faiss release/CI story, immich-ml is AGPL (external unmodified service).

@codacy-production

codacy-production Bot commented Aug 16, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 critical

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Security 1 critical

View in Codacy

🟢 Metrics 200 complexity · -95 duplication

Metric Results
Complexity 200
Duplication -95

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

semantic:"..." in KQL embeds the query text (immich-ml, multilingual CLIP)
and ranks image vectors by cosine similarity: bleve via faiss KNN behind the
new vectors build tag (RRF fusion, vector round-trip through a stored-only
field), OpenSearch via knn_vector plus client-side RRF. The filter part of
the query keeps its meaning and stays the only source of totals and facets.
@dschmidt
dschmidt changed the base branch from tmp/refactor-search-mapping to refactor/search-mapping August 18, 2026 17:30
@dschmidt
dschmidt force-pushed the feat/semantic-image-search branch from 72257a7 to 4afdbe3 Compare August 18, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant