Skip to content

Conversation

cdrini
Copy link
Collaborator

@cdrini cdrini commented Aug 21, 2025

Closes #11177

Technical

Testing

Screenshot

Stakeholders

@Copilot Copilot AI review requested due to automatic review settings August 21, 2025 12:03
@cdrini cdrini added the Needs: Special Deploy This PR will need a non-standard deploy to production label Aug 21, 2025
@github-actions github-actions bot added the Priority: 2 Important, as time permits. [managed] label Aug 21, 2025
Copy link
Contributor

@Copilot 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 adds sorting capabilities for lists by introducing last_modified and seed_count fields to the Solr schema and search functionality. The changes enable users to sort lists by modification date and seed count in both ascending and descending order.

  • Adds last_modified and seed_count properties to the list updater for Solr indexing
  • Adds corresponding fields to the Solr schema configuration
  • Updates the list search scheme to support sorting by these new fields

Reviewed Changes

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

File Description
openlibrary/solr/updater/list.py Implements last_modified and seed_count properties for list documents
openlibrary/plugins/worksearch/schemes/lists.py Adds new fields to searchable fields and sort options
openlibrary/plugins/worksearch/code.py Updates API version from 'new' to 'next'
conf/solr/conf/managed-schema.xml Defines Solr field types for the new list fields

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@property
def last_modified(self) -> str:
# Solr expects UTC ISO 8601 with 'Z' suffix, e.g. 2024-12-09T12:57:14.074200Z
return self._list['last_modified']['value'] + 'Z'
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The code assumes that last_modified['value'] doesn't already end with 'Z'. If the value already contains timezone information or ends with 'Z', this will create an invalid timestamp format. Consider checking if the timestamp already has timezone information before appending 'Z'.

Suggested change
return self._list['last_modified']['value'] + 'Z'
value = self._list['last_modified']['value']
# If value already ends with 'Z' or has a timezone offset, return as is
if value.endswith('Z') or re.search(r'[+-]\d{2}:\d{2}$', value):
return value
return value + 'Z'

Copilot uses AI. Check for mistakes.

@cdrini cdrini force-pushed the 11177/feature/new-solr-list-fields branch from 2df846a to f5cd3c9 Compare August 21, 2025 12:35
@mekarpeles mekarpeles merged commit 7084a3f into internetarchive:master Aug 21, 2025
4 checks passed
@cdrini cdrini deleted the 11177/feature/new-solr-list-fields branch August 21, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Special Deploy This PR will need a non-standard deploy to production Priority: 2 Important, as time permits. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add last_modified and seed_count fields to solr for lists

2 participants