CivicDataLab / CivicDataLab/DataSpaceBackend

Dataset search returns nothing for uppercase or multi-word queries

Open
#202 0 comments 0 reactions 1 assignee View on GitHub

@saqibmanan is already working on this.

Since Sep 18, 2026.

bug
Dominant language
Python
Stars
2
Forks
1
Avg merge
52m
Merged PRs (30d)
40

Description

What: dataset search misses obvious matches. Uppercase and multi-word queries return nothing, and long words match only through the description.

Why it matters: users on prod searching a title they can see get no results.

Evidence (/api/search/dataset/?query=…, 2026-09-18), against the title "KHOJ - Dataset about the judges of the Telangana High Court":

query dev prod
khoj 2 3
KHOJ 0 0
high court 0 0

Cause: generate_q_expression in api/views/search_dataset.py builds fuzzy queries, which aren't analyzed, so the raw input is compared as one term. The title is indexed by ngram_analyser as lowercase 4-character grams (search/documents/analysers.py), so only short, lowercase, single-word queries can match a gram within the fuzzy edit distance.

Fix: not fixed. Likely a multi_match (analyzed) query for text fields, keeping fuzziness as an option.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.