Requirements
- A database of images
- A Meilisearch project
- An embedding generation provider you can install locally
Configure your local embedding generation pipeline
First, set up a system that sends your images to your chosen embedding generation provider, then integrates the returned embeddings into your dataset. The exact procedure depends heavily on your specific setup, but should include these main steps:- Choose a provider you can run locally
- Choose a model that supports both image and text input
- Send your images to the embedding generation provider
- Add the returned embeddings to the
_vector
field for each image in your database
Configure a user-provided embedder
Configure theembedder
index setting, settings its source to userProvided
:
EMBEDDER_NAME
with the name you wish to give your embedder. Replace MODEL_DIMENSIONS
with the number of dimensions of your chosen model.
Add documents to Meilisearch
Next, use the/documents
endpoint to upload the vectorized images.
In most cases, you should automate this step so Meilisearch is up to date with your primary database.
Set up pipeline for vectorizing queries
Since you are using auserProvided
embedder, you must also generate the embeddings for the search query. This process should be similar to generating embeddings for your images:
- Receive user query from your front-end
- Send query to your local embedding generation provider
- Perform search using the returned query embedding
Vector search with user-provided embeddings
Once you have the query’s vector, pass it to thevector
search parameter to perform a semantic AI-powered search:
VECTORIZED_QUERY
with the embedding generated by your provider and EMBEDDER_NAME
with your embedder.
If your images have any associated metadata, you may perform a hybrid search by including the original q
:
Conclusion
You have seen the main steps for implementing image search with Meilisearch:- Prepare a pipeline that converts your images into vectors
- Index the vectorized images with Meilisearch
- Prepare a pipeline that converts your users’ queries into vectors
- Perform searches using the converted queries