Data ScienceNLP and text analytics

Semantic search versus keyword search for support tickets

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (5 sections)

Semantic search should retrieve relevant text when wording differs. That promise needs query-level relevance judgments and a keyword baseline. A lower-dimensional vector does not become semantic merely because it uses cosine similarity.

A tie on six queries

The local NLP lab indexes six invented support documents and evaluates six queries. Keyword search uses word TF-IDF. The latent candidate applies truncated SVD and normalization to the same corpus.

python
from nlp_cases import search_case

result = search_case()
assert len(result["queries"]) == 6
print(result["keyword_mrr"], result["latent_mrr"])

Both systems achieve mean reciprocal rank 0.511. They rank access queries with overlapping vocabulary first, but synonym-heavy queries such as “package is late” find the first delivery document at rank five. The latent representation does not improve this tiny corpus.

The comparison rejects a superiority claim. Six documents are also too few for latent structure to become meaningful; the next step is better evaluation data, not a semantic label in the UI.

Define relevance and rank metrics

Label relevant documents per query, including multiple acceptable resolutions. Report recall at the result depth a support agent sees, mean reciprocal rank for first useful result and nDCG when relevance is graded. Include zero-result and latency rates.

Create synonym, misspelling, exact-ID, multilingual and shared-keyword-negative slices. Keyword search may remain best for order IDs and error codes. Hybrid retrieval can combine exact terms and embeddings, but it becomes another candidate to evaluate.

Keep an inspectable retrieval trace

For every test query, save ranked IDs, scores and relevance labels. Do not tune on final test queries. Version documents and remove near duplicates across evaluation partitions. If a reranker is added, evaluate retrieval before and after it separately.

The Data Science course links search architecture to ranking evidence rather than feature names.

Exercise

Expand to 100 documents and 50 queries with at least two relevant results each. Compare keyword, latent, neural and hybrid candidates on recall@5, MRR, nDCG and p95 latency.

Continue learning

This article is part of the NLP and text analytics sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

Reference: scikit-learn TruncatedSVD for latent semantic analysis.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.

Explore Data Science
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.