https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39931

            Bug ID: 39931
           Summary: OPAC Sorting by Publication Year (264$c) Does Not Work
                    Correctly
 Change sponsored?: ---
           Product: Koha
           Version: 24.11
          Hardware: PC
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: OPAC
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

Created attachment 182559
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=182559&action=edit
Publication Date: Newest to Oldest / Oldest to Newest not indexing properly

In Koha version 24.11, sorting search results by publication year (newest to
oldest/oldest to newest) in the OPAC does not work as expected, even though the
correct data exists in MARC field `264$c`. The issue appears to be related to
how the publication year is indexed or handled during OPAC search result
sorting.

### Steps to Reproduce:
1. Enter bibliographic records with valid publication years in MARC field
`264$c`.
2. Rebuild Zebra/Elasticsearch index.
3. Perform a general search in the OPAC.
4. Attempt to sort by "Publication Date: Newest to Oldest and oldest to
newest".

#### Expected Result:
- Results should be sorted by publication year descending (e.g., 2024, 2023,
2022).

#### Actual Result:
- Sorting appears incorrect or inconsistent.
- Records do not appear in chronological order by publication year.

### Additional Information:
- I have verified that the data is present and sortable via direct SQL query
using XPath and regex extraction.
- Indexing configuration seems to map `264$c` to `publication_date`, but
sorting behavior does not reflect this.
- Rebuilding the index did not resolve the issue.
- This affects user experience in the public OPAC where accurate sorting by
publication date is critical.

### Suggested Fix / Enhancement:
1. Ensure that `264$c` is properly mapped in the Search Engine Configuration
for use in `publication_date`.
2. Confirm that the value is normalized and indexed as a numeric field (e.g.,
only the 4-digit year) for proper sorting.
3. Consider adding documentation or warnings if certain MARC subfields are
known to cause issues with sorting/indexing.

```If anyone has experienced this issue before or found a solution, please
share your insights!```

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to