Skip to content

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

Closed
dschmidt wants to merge 1 commit into
opencloud-eu:tmp/refactor-search-mappingfrom
dschmidt:feat/semantic-image-search
Closed

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

Conversation

@dschmidt

Copy link
Copy Markdown
Contributor

semantic:"..." in KQL embeds the query text via a CLIP inference service (immich machine-learning API, multilingual model) and ranks image vectors by cosine similarity. Images are embedded at index time by a ClipExtractor decorating the configured extractor. bleve searches via faiss KNN behind the new vectors build tag (RRF fusion for hybrid queries; vectors round-trip through a stored-only sibling field because bleve cannot return vector-typed fields), OpenSearch via knn_vector plus client-side RRF. The filter part of a query keeps its regular meaning and stays the only source of totals; purely semantic queries return only the KNN ranking with raw similarity scores. The semantic clause is split off the parsed KQL tree (query.ExtractSemantic), so quoted values like name:"*semantic:x*" stay literals.

Enable with SEARCH_EXTRACTOR_CLIP_URL pointing at an immich-machine-learning instance (works with basic and tika); bleve additionally needs a binary built with ENABLE_VECTORS=true (see the faiss stage in Dockerfile.multiarch, pinned to the blevesearch/faiss commit matching the vendored go-faiss). Existing content needs a force reindex to get vectors.

Open questions:

  • configurable vector dimensionality and model choice (currently 512, a schema constant; the startup probe hard-fails on mismatch)
  • send originals or thumbnails to the inference service (currently originals with a 50MB cap, reversible per reindex)
  • capability flag so clients can discover semantic support
  • web UX: the search bar wraps input as name:"*...*", needs a client change to issue semantic queries
  • semantic: in OR/NOT position degrades silently to an AND filter, could be rejected instead
  • release story: faiss in the official images, static binaries stay without bleve vector support, CI job for the vectors build tag
  • AGPL: immich-machine-learning is referenced as an external, unmodified service

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 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

superseded, reopened from the upstream repo

@dschmidt dschmidt closed this Aug 16, 2026
@dschmidt
dschmidt deleted the feat/semantic-image-search branch August 16, 2026 15:06
@codacy-production

codacy-production Bot commented Aug 16, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🟢 Coverage 45.28% diff coverage

Metric Results
Coverage variation Report missing for 121afae1
Diff coverage 45.28% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (121afae) Report Missing Report Missing Report Missing
Head commit (72257a7) 83397 19728 23.66%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3315) 561 254 45.28%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant