Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. Search That Understands Meaning
Python & Django

Search That Understands Meaning

Building a retrieval service in Python: chunking on meaning, not character counts, filtering before searching, adding keyword search and fresh indexes.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Chunking, embedding, indexing and retrieval. Chunking quality determines answer quality more than any other choice, and it is the part most often done carelessly.

Four components

  1. Chunking — splitting documents into retrievable passages
  2. Embedding — turning passages into vectors
  3. Indexing — storing them so similar meaning can be found
  4. Retrieval — finding the most relevant for a query
Teams spend most of their attention on the third and fourth. The first is what actually determines answer quality, and it is usually done with a default setting.

Chunk on meaning

Splitting every thousand characters cuts tables in half, separates headings from their content and produces passages that make no sense in isolation.

  • Split on document structure — sections, headings, natural boundaries
  • Keep the heading with the content it introduces
  • Do not split tables
  • Overlap slightly so context is not lost at boundaries
  • Carry metadata — source, section, date — with every chunk

Filter before searching

Permissions, recency and document type should filter the candidate set before similarity search, not after. Filtering afterwards is both slower and, for permissions, incorrect.

Most vector stores support metadata filtering during search. Use it rather than post-filtering results.

Query typeBest served by
Conceptual questionSemantic similarity
Exact product or part numberKeyword matching
A specific phraseKeyword matching
MixedBoth, combined

Pure semantic search fails badly on exact identifiers, which is a common and surprising problem in technical domains. Combining the two handles it.

Keep the index current

Documents change, and a retrieval system that reindexes nightly can be a day out of date on the morning a price changes.

Watch the source and update affected chunks within minutes. Remove deleted documents immediately — superseded content in the index is the main cause of confidently wrong answers.

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

Which vector store should we use?

For modest volumes, an extension to a database you already run is frequently sufficient and simpler. Dedicated stores earn their place at scale.

How large should chunks be?

Large enough to stand alone, small enough to be specific. Structure should determine it rather than a character count.

Do we need to re-embed when models change?

Yes — embeddings from different models are not comparable. Plan for a full reindex when changing embedding model.

How do we evaluate retrieval quality?

A set of real questions with the passages that should be retrieved. Measure whether they appear in the top results.

Keep reading

More on Python & Django

Python & Django

An API Other Systems Can Depend On

Designing a Python API service others can depend on: validation at the boundary, consistent errors and status codes, early versioning and documentation.

Python & Django

Moving and Transforming Data Reliably

Building data pipelines in Python that cope with malformed input: restartable stages, quarantining failures, reconciling counts and alerting on absence.

Start here

Retrieval returning irrelevant passages?

It is usually chunking rather than the model. Happy to look at how your documents are split.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →