MICROSIVE

Retrieval that finds the right passage for AI answers

Whether an AI answer is right depends mostly on what gets retrieved before the model writes. Treat retrieval as a search problem, and pick the simplest search method that passes testing.

Reviewed by: Rahul Jaiswar, founder

What RAG is

RAG (retrieval-augmented generation) searches a body of content for passages relevant to a question and passes them to a language model with the question. The model writes from those passages instead of from training alone.

How we use it

  • Internal agents at Microsive retrieve context before answering.
  • The Microsive ATS support chatbot answers using PostgreSQL full-text search, not a vector database (Microsive ATS).

Choosing the search method

PostgreSQL’s built-in full-text search often finds the right passages in help articles and policies, with no extra service to host (PostgreSQL). Add vector search when test questions keep using words the content doesn’t, often as hybrid search that merges keyword and vector results; our PostgreSQL guide covers that trade-off (when PostgreSQL is enough).

Access rules

Retrieval has to apply the same permissions as the rest of the software. Filter by the user’s role before passages reach the model, not after the answer is written, because a model can’t unsee a passage it was given. Test this with an account that should see less, and ask it about something only an admin may read.

Keeping the index current

Decide what triggers re-indexing: a document save, a scheduled job, or both. Remove deleted and superseded documents from the index at the same moment, or old policies keep appearing in answers. Split content along its real structure, since a table cut in half loses its meaning. Store when each passage was indexed, so a wrong answer can be traced to the version it came from.

Test sets

Collect real questions, each paired with the passage that should answer it. Score retrieval on its own (did that passage come back near the top?) before judging the written answer. Rerun the set after any change to content, splitting or search settings.

When it fits

  • The content is text people search: help articles, policies, product guides.
  • The content changes and the index can be refreshed as it does.

When it doesn’t

  • Numbers from live data. “How many invoices are overdue?” is a database query.
  • A short fixed FAQ. A plain help page or a rule may do.
  • Scanned or outdated files. Retrieval can’t fix content that is wrong or unreadable; clean it first.

Non-English and mixed-script content: check which text search configurations your PostgreSQL version ships for the languages your content uses; Hindi, for one, may not have its own. Transliterated or mixed-script text still needs the simple configuration or trigram matching (pg_trgm). Test on real user questions.

Checks for a retrieval proposal

  1. How will you measure whether the right passage was retrieved, separately from how well the answer reads?
  2. Can a user retrieve passages from documents they aren’t allowed to open?
  3. How does changed content reach the search index, and how fast?
  4. What would make you move from full-text to vector search?

Related

Is your AI feature finding the wrong passages?

Send a few questions it gets wrong and a sample of the content it searches.