-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add skip_cache parameter to bypass similarity search cache in Feed API #2095
Conversation
if skip_cache | ||
results = Bot::Smooch.search_for_similar_published_fact_checks_no_cache(type, query, feed.team_ids, after, feed_id) | ||
else | ||
results = Bot::Smooch.search_for_similar_published_fact_checks(type, query, feed.team_ids, after, feed_id) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jayjay-w as per our conversation, let's move this logic to inside Bot::Smooch.search_for_similar_published_fact_checks
- so, this is the method that can receive the skip_cache
parameter and then bypass cache if true
- please confirm if Rails.cache.fetch
can take a force
argument that bypasses cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it turns out there's no force
option for Rails.cache.fetch
, so I changed this to use a conditional if.
- Introduced `skip_cache` parameter to Feed API, allowing requests to bypass the similarity search cache when set to `true`. - Updated `search_for_similar_published_fact_checks` in `SmoochSearch` to support cached and non-cached search logic. - Added `search_for_similar_published_fact_checks_no_cache` method to perform non-cached similarity searches. - Modified `FeedResource` to handle and pass the `skip_cache` parameter. - Implemented automated test for `skip_cache` functionality to ensure correct behavior. - Updated logging for better traceability of cache usage in similarity searches.
5a4d4f5
to
1e7eb7a
Compare
1e7eb7a
to
7c0240d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure tests are fixed and code is still fully covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing all comments from the previous PR review!
#2095) * Add skip_cache parameter to bypass similarity search cache in Feed API - Introduced `skip_cache` parameter to Feed API, allowing requests to bypass the similarity search cache when set to `true`. - Updated `search_for_similar_published_fact_checks` in `SmoochSearch` to support cached and non-cached search logic. - Added `search_for_similar_published_fact_checks_no_cache` method to perform non-cached similarity searches. - Modified `FeedResource` to handle and pass the `skip_cache` parameter. - Implemented automated test for `skip_cache` functionality to ensure correct behavior. - Updated logging for better traceability of cache usage in similarity searches. * Add reviewer feedback * Add reviewer feedback
Description
skip_cache
parameter to Feed API, allowing requests to bypass the similarity search cache when set totrue
.search_for_similar_published_fact_checks
inSmoochSearch
to support cached and non-cached search logic.search_for_similar_published_fact_checks_no_cache
method to perform non-cached similarity searches.FeedResource
to handle and pass theskip_cache
parameter.References: CV2-2400
How has this been tested?
Ensured all existing tests are still passing
Things to pay attention to during code review
Check if anything was missed
Checklist