Skip to content

Fix: Search Index Stale After Post Deletion #37

Description

@Techhackontime999

Description

Deleted posts continue to appear in search results until the search cache expires naturally (which can be up to 1 hour).

Steps to Reproduce

  1. Create a post with unique content
  2. Search for that content - finds the post
  3. Delete the post
  4. Search again immediately - the deleted post still appears
  5. Wait for cache to expire - post disappears

Expected Behavior

Deleted posts should be immediately removed from search results.

Root Cause

The search cache (Redis) stores results by query hash, and deleting a post doesn't invalidate the relevant search cache entries.

Files to Fix

  • linkup/feed/views.py - On post delete, invalidate search cache entries
  • linkup/core/views.py - Add cache invalidation method for search results
  • linkup/core/performance.py - Add targeted cache invalidation

Acceptance Criteria

  • Deleted posts disappear from search immediately
  • Cache invalidation doesn't affect unrelated cached queries
  • Search performance is not degraded by invalidation

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend/API workbugSomething isn't workingintermediateIntermediate level

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions