Add semantic package search via pgvector embeddings
Package text search now combines several strategies: exact name match,
name prefix promotion, compound word splitting ("sqlite browser" finds
"sqlitebrowser") and semantic nearest neighbor search over description
embeddings computed by an external embedding service (all-MiniLM-L6-v2,
384 dims) stored with the pgvector extension. Classic PostgreSQL
full-text search remains as fallback when the vector service is
unreachable. Gibberish queries without lexical overlap with the package
data return empty results instead of random matches.
Embeddings can be backfilled with bin/rails debshots:compute_vectors.
Also drops the unused lograge gem from the Gemfile.
This commit is contained in:
parent
c7e8109bbd
commit
4948fe50e3
15 changed files with 662 additions and 125 deletions
7
Gemfile
7
Gemfile
|
|
@ -41,8 +41,7 @@ gem 'mini_magick'
|
|||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem 'bootsnap', require: false
|
||||
|
||||
# Structured logging for production
|
||||
gem 'lograge'
|
||||
|
||||
|
||||
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
||||
gem 'kamal', require: false
|
||||
|
|
@ -124,6 +123,10 @@ gem 'will_paginate-foundation'
|
|||
# Full-text search in PostgreSQL
|
||||
gem 'pg_search'
|
||||
|
||||
# Nearest neighbor search for PostgreSQL using the pgvector extension
|
||||
# https://github.com/ankane/neighbor
|
||||
gem 'neighbor'
|
||||
|
||||
# Use SLIM as our templating language
|
||||
gem 'slim-rails'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue