Search with a quoted phrase plus other words returns the whole catalog
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
The issue points to app/search/queries/registry.py and names parse_search_query, build_base_query, and unit tests to add. Read build_base_query and the existing query tests first. Done means phrase-plus-word and two-phrase searches require every term to match, while a phrase with no matches returns no results.
Written by the indexing model from the issue text.
Description
A catalog search that combines a quoted phrase with plain words, without OR, ignores the search and returns the whole catalog sorted by popularity.
- Environment: prod catalog.data.gov
- Component: datagov-catalog search,
app/search/queries/registry.py
How to reproduce
- Search https://catalog.data.gov/search?q=%22baby%20names%22%20california
- Compare with https://catalog.data.gov/search?q=%22baby%20names%22
- Try a phrase that matches nothing: https://catalog.data.gov/search?q=%22zzzqqq%20nomatch%22%20california
Expected behavior
- Results must contain the phrase "baby names" and the word "california".
- A phrase that matches nothing returns no results.
Actual behavior
- The first and third searches both return the whole catalog, starting with "Electric Vehicle Population Data".
parse_search_queryreturns two terms withhas_orfalse.build_base_queryonly handles one term in that case and otherwise falls back to{"match_all": {}}. The comment there says "Shouldn't happen, but fall back to match_all".
Sketch
- When there's more than one term and no OR, combine them with a
boolmust, so every phrase and word has to match - Add unit tests for a phrase plus a word, and for two phrases without OR
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 207
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GSA/data.gov
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Harvester
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
blocked form submission shows home pagePossibly taken @FuhuXia claimed this 1 day ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
idle-in-transaction for harvest record selectionPossibly taken @theyottaboy claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Harvester pagination: add page-number navigation to paginationPossibly taken @jaredb96 claimed this 24 days ago. Openbug Harvester
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Similar issues
-
docs(contributing): the two things that silently block a PRPossibly taken A pull request linked to this issue is open or already merged. Openavailable documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Nixitov/Riptide-Native#944 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
JTHCode/secretguard#24 ·
Maintainers usually reply within 1 day
-
area: middleware documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainers usually reply within 1 day