LuceneDistanceToFieldProjection is not thread safe

Description

LuceneDistanceToFieldProjection mutates its state when contributeCollectors is called, but it can be used simultaneously from multiple threads, so this is not a good idea.

The state should be stored in a separate, thread-specific context object. See what we did in org.hibernate.search.backend.elasticsearch.search.projection.impl.ElasticsearchDistanceToFieldProjection#contributeRequest for example.

Environment

None

Status

Assignee

Fabio Massimo Ercoli

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure