Skip to content

About

Reference implementation for vector search on Kulturpool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Kulturpool Vector Search

The reference implementation for vector search on Kulturpool, deployed at https://vector.kulturpool.ai.

It uses the public Kulturpool APIs at https://api.kulturpool.at (reference). They need no key, so the browser calls them directly; nginx only serves the static page.

The index carries two vectors per object:

field model what it encodes
imageEmbedding CLIP, 512d the thumbnail: what the picture depicts
metadataEmbedding multilingual-e5, 384d the descriptive metadata: what the record is about

Four views, one result grid:

  • random: sort_by=_rand(), something to start from
  • text: the API embeds the query with the field's own model
  • similar: nearest neighbours of a clicked object, optionally excluding its institution
  • image: nearest neighbours of a dropped, pasted or uploaded picture
GET  /v2/search         random draw, text search, one object by id
GET  /v2/similar        neighbours of a stored object
POST /v2/similar/image  neighbours of a picture; answers with its vector
GET  /v2/similar/image  the same search again from that vector (not rate-limited)

All query construction lives in web/kulturpool.js.

Run

docker compose up --build

Open http://localhost:8080. web/ is mounted, so edits need only a reload. KULTURPOOL_API in .env (see .env.example) selects the API.

Deploy

.gitlab-ci.yml builds the image and deploys docker-compose.ci.yml to production. KULTURPOOL_API is the only setting; the container writes it into config.js at startup.

URL parameters

Everything on screen is in the query string, so a result is a link. Only non-default values are written; precedence on load is defaults < localStorage < URL.

key values default
view random, text, similar, image start screen
q text query
doc reference object UUID
vec image vector returned by the API (1366 chars)
exclude 1: drop the reference object's institution off
mode metadata image
n 12, 24, 48, 96, 150 24
t 0–2, distance cutoff off
images 0: include objects without a picture 1
txt 1: include edmType TEXT objects off

view=random cannot be reproduced (_rand() has no seed). A shared image link carries the vector, not the picture.

Notes

  • TEXT objects are excluded by default. Scanned books, newspapers and manuscripts are a third of the collection and their page scans crowd every CLIP neighbourhood.
  • A vector search always returns something. It ranks the whole collection; the summary line shows the distance band. Typical good matches: ~0.1 on metadataEmbedding, ~0.65 on imageEmbedding (text or photo query). Set the cutoff t per field.
  • Uploads are scaled in the browser (scaleDown in web/app.js) to a 512px shortest edge in halving steps, with EXIF orientation applied and alpha on white. The API embeds once (ten a minute per address); later searches replay the returned vector.
  • Records without a usable image have no imageEmbedding; their image neighbours return a 400, use metadata mode.

Layout

web/index.html, app.js, style.css   the page
web/kulturpool.js                   API calls and query expressions
web/config.js                       API base URL, rewritten at container start
docker/                             nginx config and the config.js writer
tests/query.test.mjs                node --test, no dependencies

License

MIT

About

Reference implementation for vector search on Kulturpool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages