apache / apache/lucene

Sort and SortField are not immutable [LUCENE-9325]

Open
#10,365 4 comments 0 reactions 1 assignee Claimed by @romseygeek View on GitHub
legacy-jira-priority:Major type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

The `Sort` and `SortField` classes are currently mutable, which makes them dangerous to use in multiple threads. In particular, you can set an index sort on an IndexWriterConfig and then change its internal sort fields while the index is being written to.

We should make all member fields on these classes final, and in addition we should make `Sort` final itself.

---
Migrated from [LUCENE-9325](https://issues.apache.org/jira/browse/LUCENE-9325) by Alan Woodward (@romseygeek), updated Oct 06 2021
Pull requests: https://github.com/apache/lucene/pull/338

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.