# Searching for clothes with a photo

By Valentin Galfré · Published 2026-09-09 · 3 min read · https://galfrevn.com/writing/photo-search

> How pilcha finds every garment in a photo and returns the closest thing an Argentine store sells right now. Mostly plumbing.

Someone posts an outfit. You want the jeans. Not jeans like those, those jeans, or the closest thing an Argentine store sells this week, at a price in pesos, in your size, in stock.

That is the feature in pilcha I am proudest of, and it is the one that looks like magic and is mostly plumbing.

## Every garment in the photo

The naive version of photo search embeds the whole image and looks for whole images that resemble it. That finds outfits, not clothes. Nobody wants to buy an outfit.

So the first step is detection. The photo goes through a model that finds every garment in it and returns a box per garment: jacket, jeans, sneakers. Each box becomes its own search. One photo, two garments, two result sets, and the user picks which one they meant. Anything that is not clothing is dropped before it costs a query.

## The closest thing a store actually sells

Each crop is embedded and compared against every product pilcha has indexed: more than 320,000 active items from more than 1,250 stores across Tiendanube, Shopify, Empretienda, VTEX and WooCommerce. The comparison happens in Postgres, on vectors, and it has to come back fast enough that the page feels like search and not like a request.

The interesting constraint is that "closest" has to mean closest among things you can buy today. A match on a product that sold out or a store that stopped updating is a wrong answer with a high score. The index only holds what is live, which is why the crawler and the normalizer are the real product and the search box is the demo.

> **Truth.** The model is the easy part. The index is the product.

## Why it works on my photo

The detector does not care about brand, and neither does the embedding. That is a feature. A hoodie from a store pilcha does not index still returns the nearest hoodies from the ones it does. Search that only works on catalog photos is not photo search, it is a barcode scanner.

## No commissions, no thumb on the scale

pilcha does not sell anything. Every result links to the store. That sounds like a business decision, and it is also a search decision: when you do not earn from a click, the only incentive left is to be right. The ranking has nothing to optimize but the distance.

> Take a photo, get the closest thing an Argentine store sells right now. Everything else is what it took to make that sentence true.
