5 ms·
Using Vectorize to build an unreasonably good search engine in 160 lines of code
- Supermancho 10mo agoSite has a neat feature where you can see the pointers of other people, marked by regional? notations, scrolling through the content.
- wormpilled 10mo agoIt's amazing! Got so distracted, gotta switch to reader mode haha. Never seen anything like that.
- fnord77 10mo agothat got annoying fast
- wqaatwt 10mo agoSeems fantastic for analytics. I wonder how many news sites do that
- TheLNL 10mo agoIt doesn't look to be live though, I didn't see anyone reacting to weird cursor movements I was making
- mips_avatar 10mo agoThere’s a lot of previously intractable problems that are getting solved with these new embeddings models. I’ve been building a geocoder for the past few months and it’s been remarkable how close to google places I can get with just slightly enriched open street maps plus embedding vectors
- occupant 10mo agoThat sounds really interesting. If you’re open to it, I’d be curious what the high-level architecture looks like (what gets embedded, how you rank results)?
- isaachh 10mo agoId love to hear more about this
- robrenaud 10mo agoWhat are you embedding? Are you doing a geo restricted area (small universe?).
- mips_avatar 10mo agoYeah basically similar to the Gemini google maps grounding api, except all open data
- ballpug 10mo ago[dead]
- repeekad 10mo agoWhat about re-ranking? In my limited experience, adding fast+cheap re-ranking with something like Cohere to the query results took an okay vector based search and made top 1-5 results much stronger
- vjerancrnjak 10mo agoQuery expansion works better.
- repeekad 10mo agoQuery expansion happens before the retrieval query, reranking is applied after the ranked results are returned, both are important
- sa-code 10mo agoQuery expansion and re ranking can and often do coexist Roughly, first there is the query analysis/manipulation phase where you might have NER, spell check, query expansion/relaxation etc Then there is the selection phase, where you retrieve all items that are relevant. Sometimes people will bring in results from both text and vector based indices. Perhaps and additional layer to group results Then finally you have the reranking layer using a cross encoder model which might even have some personalisation in the mix Also, with vector search you might not need query expansion necessarily since semantic similarity does loose association. But every domain is unique and there’s only one way to find out
- sgk284 10mo agoReranking is definitely the way to go. We personally found common reranker models to be a little too opaque (can't explain to the user why this result was picked) and not quite steerable enough, so we just use another LLM for reranking. We open-sourced our impl just this week: https://github.com/with-logic/intent https://github.com/with-logic/intent We use Groq with gpt-oss-20b, which gives great results and only adds ~250ms to the processing pipeline. If you use mini / flash models from OpenAI / Gemini, expect it to be 2.5s-3s of overhead.
- simonw 10mo agoI was super-excited about vector search and embeddings in 2024 but my enthusiasm has faded somewhat in 2025 for a few reasons: - LLMs with a grep or full-text search tool turn out to be great at fuzzy search already - they throw a bunch of OR conditions together and run further searches if they don't find what they want - ChatGPT web search and Claude Code code search are my favorite AI-assisted search tools and neither bother with vectors - Building and maintaining a large vector speech index is a pain. The vector are usually pretty big and you need to keep them in memory to get truly great performance. FTS and grep are way less hassle. - Vector matches are weird. So you get back the top twenty results... those might be super relevant or they might be total garbage, it's on you to do a second pass to figure out if they're actually useful results or not. I expected to spend much of 2025 building vector search engines, but ended up not finding them as valuable as I had thought.
- markerz 10mo agoThe problem with LLMs using full-text-search is they’re very slow compared to a vector search query. I will admit the results are impressive but often it’s because I kick off an agent query and step away for 5 minutes. On the other hand, generating and regenerating embeddings for all your documents can be time consuming and costly, depending on how often you need to reindex
- leobg 10mo agoNot an apples to apples comparison. Vector search is only fast after you have built an index. The same is true for full text search. That too, will be blazing fast once you have built an index (like Google pre-transformer).
- markerz 10mo agoLLMs will always have the tool call overhead, which I find to be quite expensive (seconds) on most models. Directly using vector databases without the LLM interface gets you a lot of the semantic search ability without the multi-second latency, which is pretty nice for querying documents on a website. E.G. finding relevant pages on a documentation website, showing related pages, etc. Can be applied to GitHub Issues to deduplicate issues, or show existing issues that could match what the user is about to report. There are plenty of places where “cheap and fast” is better and an LLM interface just gets in the way. I think this is a lot of the unsqueezed juice in our industry.
- sa-code 10mo agoModels like bge are small and quantized versions will fit in browser or on a tiny machine. Not sure why everyone reaches for an API as their first choice
- yuzhun 10mo agoWhile embeddings are generally not required in the context of code, I am interested in how they perform in the legal and regulatory domain, where documents are substantially longer. Specifically, how do embeddings compare with approaches such as ripgrep in terms of effectiveness?
- RomanPushkin 10mo agoYou might be getting a good _recall_ rate, since vectorize search is ANN, but the _precision_ can be low, because reranker piece is missing. So I would slightly improve it by adding 10 more lines of code and introducing reranker after the search (slightly increasing topK). Query expansion in the beginning can be also added to improve recall.
- ____tom____ 10mo agoYou didn't build a search engine in 160 lines of code. You build a client for a search engine in 160 lines of code. The vector database is providing the search.
- ivanjermakov 10mo agoLook, I made a thing in two lines of code! import thing from everything thing()
- fortyseven 10mo agoImpressive! My company is willing to buy this from you for 200 million dollars.
- croemer 10mo agoMissing a (2024)
- novoreorx 10mo agoTrue, it's as if embedding and vector search have just come out
- daquisu 10mo agoNow it is even easier. Cloudflare has a beta product called AI Search that implements most of these 160 lines of code
- abhinavb05 10mo agoAt my workplace we are using vector embedding to build recommendation system and the results are amazing
- wg0 10mo agoCould you elaborate on the storage engine and processing pipeline if not confidential?
- alansaber 10mo agoGood to see the article touching on the performance impact of a niche vs general embedding model/aggressive subword tokenization
- jdthedisciple 10mo agoSo it's an ad for partykit and they're just doing what anyone does by now? Really dislike this type of content...