Skip to content

Convert Photos controller to avoid elasticsearch#4675

Merged
CloCkWeRX merged 2 commits into
devfrom
convert-photos-to-sql-4865766049333411151
Jun 23, 2026
Merged

Convert Photos controller to avoid elasticsearch#4675
CloCkWeRX merged 2 commits into
devfrom
convert-photos-to-sql-4865766049333411151

Conversation

@CloCkWeRX

Copy link
Copy Markdown
Collaborator

Converted the Photos controller and model from using Elasticsearch (via Searchkick) to plain SQL queries using ActiveRecord. This includes refactoring the index action to use model associations for filtering, adding eager loading for performance, and removing the SearchPhotos concern and its corresponding file. Tests have been updated to reflect these changes and have been verified to pass.


PR created automatically by Jules for task 4865766049333411151 started by @CloCkWeRX

- Refactored `PhotosController#index` to use ActiveRecord queries instead of Searchkick/Elasticsearch.
- Handled filtering by crop and planting via associations.
- Added eager loading for the photo owner to prevent N+1 queries.
- Decoupled the `Photo` model from Elasticsearch by removing the `SearchPhotos` concern.
- Deleted `app/models/concerns/search_photos.rb`.
- Updated controller and model specs to use standard ActiveRecord expectations.
- Cleaned up the photo factory by removing the now-obsolete `:reindex` trait.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@CloCkWeRX CloCkWeRX changed the title Convert Photos controller to plain SQL queries Convert Photos controller to avoid elasticsearch Jun 23, 2026
@CloCkWeRX
CloCkWeRX merged commit 3af51f1 into dev Jun 23, 2026
1 of 16 checks passed
@CloCkWeRX
CloCkWeRX deleted the convert-photos-to-sql-4865766049333411151 branch June 23, 2026 12:21
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.

1 participant