Skip to content

fix(search): parse multi-word class and superclass filter values#819

Open
vcnainala wants to merge 1 commit into
mainfrom
fix/818-multi-word-filter-search
Open

fix(search): parse multi-word class and superclass filter values#819
vcnainala wants to merge 1 commit into
mainfrom
fix/818-multi-word-filter-search

Conversation

@vcnainala

Copy link
Copy Markdown
Member

Summary

  • Fixes filter search failures for multi-word chemical class and superclass names (e.g. class:Unsaturated+hydrocarbons, superclass:Organometallic+compounds) reported in Search fails for class and superclass names containing multiple words #818
  • Adds key-aware filter query tokenization in parseFilterQueryTokens() so values with spaces are not split after URL decoding
  • Normalizes text filter values to hyphenated lowercase to match existing DB-side REGEXP_REPLACE logic
  • Aligns Advanced Search URL encoding with hyphen slugs used elsewhere (molecule detail links, compound classes page) and fixes a JS template literal bug in query string generation

Test plan

  • php artisan test --filter=ParseFilterQuery (8 tests)
  • /search?type=filters&q=class:Unsaturated+hydrocarbons returns results without error
  • /search?type=filters&q=superclass:Organometallic+compounds returns results without error
  • /search?type=filters&q=class:acyl-halides still works (regression)
  • /search?type=filters&q=tac:4..6 mw:100..200 combined AND filters still work
  • Advanced Search: select "Unsaturated hydrocarbons" → query shows class:unsaturated-hydrocarbons → search succeeds

Fixes #818

Filter queries such as class:Unsaturated+hydrocarbons were split on
spaces after URL decoding, causing SQL errors. Add key-aware filter
tokenization, normalize text values to hyphen slugs, and align Advanced
Search encoding with existing search links.

Fixes #818
@vcnainala vcnainala added PR pending An open pull request addresses this issue and removed PR pending An open pull request addresses this issue labels Jun 9, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e4a4f53). Learn more about missing BASE report.

Files with missing lines Patch % Lines
app/Actions/Coconut/SearchMolecule.php 0.00% 5 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             main    #819   +/-   ##
======================================
  Coverage        ?   6.13%           
  Complexity      ?    1738           
======================================
  Files           ?     227           
  Lines           ?    8962           
  Branches        ?       0           
======================================
  Hits            ?     550           
  Misses          ?    8412           
  Partials        ?       0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search fails for class and superclass names containing multiple words

2 participants