Skip to content

Syntax logical error - #220

Open
ArvKmr08 wants to merge 2 commits into
vicharanashala:mainfrom
ArvKmr08:syntax-logical-error
Open

Syntax logical error#220
ArvKmr08 wants to merge 2 commits into
vicharanashala:mainfrom
ArvKmr08:syntax-logical-error

Conversation

@ArvKmr08

Copy link
Copy Markdown

What changed

This PR resolves a known limitation where the hybrid search pipeline strictly hardcoded the vectorScore filter cutoff to 0.80, completely ignoring custom configuration boundaries passed from administrative panels or user interactions. Additionally, it ensures the controller safely destructures and supports both the primary query parameter and the shorthand q alias key to prevent invalid validation failures when shorthand payloads are delivered by client-side elements. Finally, it updates the documentation to align with these operational pipeline improvements.

Related issue

Closes #168

Type of change

  • Bug fix
  • Feature
  • Refactor (no behaviour change)
  • Docs / comments only
  • CI / tooling

Area affected

  • Backend (Express / Mongoose)
  • Frontend (React / Vite)
  • Admin / Train tab (/admin/*)
  • Community (/community — posts, comments, auto-answer)
  • Search (hybrid text retrieval, training stats)
  • Auth / middleware / samagama.in bridge
  • Crons / schedulers / embedding-warm
  • Observability (Sentry / logging / Discord alerts)
  • Docs

CI verification

  • cd apps/backend && npx tsc --noEmit exits 0
  • cd apps/backend && npx vitest run — all tests pass
  • cd apps/frontend && npx tsc --noEmit exits 0
  • cd apps/frontend && npx vitest run — all tests pass
  • pnpm run lint — 0 errors (152 warnings is the baseline)
  • GitHub Actions green on the merge commit (CI, CodeQL, Build & Deploy)
  • Tested with a real API hit or browser interaction if behaviour changed
  • Tests added or updated for the change
  • Single logical change — unrelated fixes noted in description, not fixed here
  • Docs updated if route / API / env var / pipeline behaviour changed
  • Rebased onto main, no merge commits

Notes for reviewer

  • Signature Refactor: The signature of applySearchThreshold in apps/backend/src/utils/http/search.ts was refactored to take an optional vectorCutoff: number = 0.80 argument, which ensures full backwards compatibility across any un-migrated code paths.
  • Payload Fallback Integration: The fallback mapping logic uses const activeQuery = query || q;. If neither is provided, the API cleanly throws a 400 Bad Request as expected.
  • Documentation Updates: Per the repo's contribution rules, docs/PIPELINES.md was updated in the exact same commit sequence to document the functionality of the dynamic parameter.

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.

applySearchThreshold ignores configurable thresholds

1 participant