Skip to content

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Nov 1, 2025

We were seeing high bot traffic to this page, resulting in solr strain across the whole site. Turning off the facets (i.e. the subjects/places/etc) in the sidebar of the authors page, and we seem to be doing much better. They're still hitting us and traffic is 1.5x normal, but we now seem to be able to weather it.

We want to turn these back on, but make them lazy load similarly to the facets on the search page.

Technical

Testing

Screenshot

image
  • A: when the high traffic began
  • B: When this PR was patch deployed

Stakeholders

@cdrini cdrini added Theme: Performance Issues related to UI or Server performance. [managed] Patch Deployed This PR has been deployed to production independently, outside of the regular deploy cycle. labels Nov 1, 2025
@cdrini cdrini marked this pull request as ready for review November 1, 2025 13:27
Copilot AI review requested due to automatic review settings November 1, 2025 13:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR disables facet fetching for author book pages by setting facet=False in the Solr query and updates the template to check for the existence of facet_counts before rendering subject sections.

  • Disabled facet fetching in the get_books() method to improve query performance
  • Added defensive check in the template to prevent errors when facet data is not available

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
openlibrary/plugins/upstream/models.py Changed facet parameter from True to False in the works_by_author call within Author.get_books()
openlibrary/templates/type/author/view.html Updated condition to check both books_count and books.facet_counts before rendering subjects

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +169 to 170
$if books_count and books.facet_counts:
$:render_subjects(_("Subjects"), books.facet_counts.get('subject_facet'), '')
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks for books.facet_counts but this is redundant with the backend change that sets facet=False. Since facets are now disabled in the backend, this entire subjects display section (lines 169-173) will never render. Consider removing this code block entirely or documenting why it's being kept if there are plans to re-enable facets in the future.

Copilot uses AI. Check for mistakes.
@cdrini cdrini marked this pull request as draft November 1, 2025 17:13
@cdrini cdrini force-pushed the hotfix/disable-author-facets branch from e003dcf to 31ea664 Compare November 1, 2025 17:25
@cdrini cdrini force-pushed the hotfix/disable-author-facets branch from 31ea664 to 05fe72a Compare November 1, 2025 17:28
@cdrini
Copy link
Collaborator Author

cdrini commented Nov 4, 2025

@jimchamp notes this is likely causing this error on testing:
image

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

Labels

Patch Deployed This PR has been deployed to production independently, outside of the regular deploy cycle. Theme: Performance Issues related to UI or Server performance. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant