StudyBoost Docs

Feature: Search Feature Implementation (FEAT-58)

Metadata

  • Issue ID: FEAT-58
  • Status: Done
  • Owner: Kzu0-afk
  • Related PRs: TBD
  • Canonical feature doc: docs/features/FEAT-58-Search-Feature-Implementation.md

Overview

FEAT-58 improves search and ranking quality across discovery surfaces:

  • Explore page
  • Institutions directory
  • Courses directory
  • Documents directory

The objective is stronger discoverability and monetization support while preserving relevance, stability, and SEO-friendly behavior.


Frontend Behavior

  • Uses URL-driven search state (q, sort, page) on directory pages for shareability and crawl consistency.
  • Keeps entity-specific search + sort controls with clear empty-result and fallback states.
  • Preserves active filters across pagination links.
  • Maintains current Explore-page strategy:
    • lightweight client-side filter for preloaded cards in v1;
    • deeper backend-powered search integration planned for follow-up phase.
  • Allows optional local persistence only for non-sensitive UX preferences (recent query/sort context), with URL state remaining authoritative.

Backend Behavior

  • Existing catalog APIs already support paginated query + sort:
    • GET /institutions
    • GET /courses
    • GET /documents
    • plus scoped variants (/institutions/:slug/courses, /courses/:slug/documents)
  • Ranking/signals currently used:
    • documents: quality, downloads, views, trending/engagement, topic tags
    • courses: popularity, document depth, trending
    • institutions: course/document breadth and location/name relevance
  • FEAT-58 planning includes continued relevance tuning, deterministic tie-breakers, and bounded query behavior.

QA Test Scenarios

Scenario IDDescriptionStepsInputExpected Result
FEAT-58-01Happy path: document search by titleOpen /documents, enter known title term, submitq=<known title token>Relevant documents appear first; pagination and sort remain functional
FEAT-58-02Happy path: course search by codeOpen /courses, search by course codeq=CS101Matching course cards are returned with stable ordering
FEAT-58-03Happy path: institution search by locationOpen /institutions, search by city/stateq=<city/state>Institutions in that location appear; no irrelevant crash/fallback
FEAT-58-04Validation: blank querySubmit empty query with active sortq="", sort=popularDefault ranked listing returns; no API error
FEAT-58-05Validation: very long querySubmit long free text querylong string (>= 300 chars)API responds safely, no timeout/crash, UI shows empty/limited results gracefully
FEAT-58-06Validation: unsupported sort valueForce unknown sort in URLsort=unknown_sortAPI falls back to safe default sort (popular); UI still renders
FEAT-58-07Backend failure handlingSimulate backend unavailable for listing endpointAPI 5xx or connection failureUI shows error-safe fallback state and does not white-screen
FEAT-58-08Edge case: no matchesQuery nonexistent tokenq=zzzz_nonexistent"No results" state appears with clear message per entity
FEAT-58-09Edge case: query persistence with paginationSearch then move to page 2q=<term>&page=2Query + sort are preserved in URL and pagination links
FEAT-58-10Monetization safetySearch results page with ad slot enablednormal query flowSearch remains usable; ad placement does not block controls/content
FEAT-58-11Sort option persistence across paginationSelect "Trending" sort, paginate to page 3, reloadsort=trending&page=3Sort dropdown reflects "Trending"; correct sort applied to API call
FEAT-58-12Explore page: client-side institution filterOpen /, type partial institution name in search barsearch input textMatching institutions appear immediately (client-side); no page reload
FEAT-58-13Explore page: empty client filterOpen /, type nonexistent institution namesearch input text (no match)"No institutions match your search right now." message appears
FEAT-58-14Phase 2: document search by topic tagOpen /documents, search by a known tag termq=<tag term>Documents with matching topic_tags appear in results (requires Phase 2 topic_tags search extension)
FEAT-58-15Pagination reset on new queryOn /documents?q=old&sort=popular&page=3, enter new query, submitnew q valueURL resets to page=1 (form omits page param); results reflect new query

Edge Cases

  • Long or symbol-heavy queries.
  • Query/sort persistence across pagination transitions.
  • URL vs localStorage preference mismatch (URL wins).
  • Ranking drift when engagement signals update between page loads.
  • Explore-page partial preload vs deep catalog search expectations.

Notes

  • This SBDocs page is a compact index view; the canonical implementation details remain in the FEAT-58 feature doc.
  • No mock/placeholder search data is introduced.
  • No auth/session model changes are part of FEAT-58 search scope.
  • #279 update — Explore region filter (backend-powered): the Explore region chips (Near You / Northeast / Southeast / Midwest / West / Canada) are now wired to a real, URL-driven (?region=<slug>) location filter on GET /institutions — the backend follow-up to the client-side v1 noted above. Region slugs map to institution_country / institution_state full-name values server-side (backend/src/institutions/institution-regions.ts) using the dedicated location indexes. "Near You" is a no-filter default in Phase 1 (geolocation deferred to Phase 2). Canonical feature doc: docs/features/279-location-region-filter.md.