Persist Content in Database #63
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implement content persistence with checksum-based deduplication to efficiently store and manage fetched page content in the database.
Fixes #23
Changes Made
Detailed Changes
clean_htmlandclean_textcolumns, renamed existing columns toraw_html/raw_textfor clarityContentRepositorywith efficient upsert functionality using MD5 checksum-based duplicate detection(item_id, checksum)for deduplication and GIN index onclean_textfor future full-text searchfetch_pagejob handler to use new column names and repository patternsTesting
make test)Test Commands Run
make testAll 86 tests pass including comprehensive unit tests for ContentRepository covering insert, update, and no-op scenarios.
Code Quality
make fmt)make lint)make check)Database Changes
make preparerun after schema changesMigration
20250829081421_extend_contents_tableextends the existing schema without breaking existing functionality.Breaking Changes
Deployment Notes
Documentation
Additional Notes
This implementation provides efficient content deduplication using MD5 checksums to avoid unnecessary database writes when content hasn't changed. The new schema separates raw content from cleaned content, setting up the foundation for future full-text search capabilities with the GIN index on
clean_text.