---
title: "Discussion on \"What I learned building a RAG notes app\" | Hashnode"
description: "Discussion on \"What I learned building a RAG notes app\". Embeddings, vector search, reranking, and getting Flutter, Spring Boot and Python to talk to each other"
url: "https://hashnode.com/posts/what-i-learned-building-a-rag-notes-app/6aed9cf3af39498fe75b6f87"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [What I learned building a RAG notes app](https://trialswithtech.hashnode.dev/what-i-learned-building-a-rag-notes-app?utm_source=hashnode&utm_medium=feed)

Embeddings, vector search, reranking, and getting Flutter, Spring Boot and Python to talk to each other

Nov 6 · 13 min read · trialswithtech.hashnode.dev  
Updated 12h ago  
Read the article

-   [#rag](https://hashnode.com/tag/rag)
-   [#python](https://hashnode.com/tag/python)
-   [#postgresql](https://hashnode.com/tag/postgresql)
-   [#springboot](https://hashnode.com/tag/springboot)
-   [#ai](https://hashnode.com/tag/ai)

## Written by

[Abhishek Panja](https://hashnode.com/@abhishekpanja554)

@abhishekpanja554 · Bengaluru, India

  
[View profile](https://hashnode.com/@abhishekpanja554)

A fellow curious person.

## Responses 2

Markdown supported · ⌘↵ to post

[Ahmet Özel](https://hashnode.com/@ahmetozel)

[Nov 7](https://hashnode.com/posts/what-i-learned-building-a-rag-notes-app/6aed9cf3af39498fe75b6f87/comment/6aef42d1b8079c2fa10e274d)

The keyword-only fallback to a note's first piece can lose a correct candidate even after retrieval succeeded. If the matching term and answer sit near the end of a long note, the reranker sees its unrelated introduction and can discard the very note that keyword search found.

I would preserve the keyword match location and map it to the corresponding piece before reranking. One fixture with the answer only in the final piece would distinguish this from the separate top-20 candidate problem you described, and stage-level results would show whether the note disappeared before or during reranking.

[Abhishek Panja](https://hashnode.com/@abhishekpanja554)

[13h ago](https://hashnode.com/posts/what-i-learned-building-a-rag-notes-app/6aed9cf3af39498fe75b6f87/comment/6aef42d1b8079c2fa10e274d#reply-6af94a2566f102f4b888e943)

Good catch. You’re absolutely right, the version in the post only passed the first chunk of a keyword-only note to the reranker. I ran into something similar while building the evals, where a long note was getting scored on the wrong chunk and the model completely missed the answer.

I ended up going with a slightly different fix than what you suggested. Now, a keyword-only note passes all its chunks to the reranker, and the note takes the max score across its chunks. It then adds a few extra reranker calls for longer notes, but it handles cases where the keyword and the actual answer are in different chunks.

Though, I haven't implemented that fixture idea yet. For now, vector search catches everything in my test set, so the keyword-only path isn't really getting exercised. I will add a specific fixture that only keyword search can hit, drop the answer in the last chunk, and see how it holds up.

Appreciate you reading through it so closely!
