Search 6 groundwork - Clarify the behavior of Lucene GeoPoint field codecs with respect to searchable/sortable/projectable

Description

Currently the Lucene GeoPoint fields add a LatLonDocValuesField if (and only if) users called sortable( Sortable.YES ) when defining the field.

  • If they didn't call it, we'll probably get an NPE somewhere, since sortable will be null instead of YES/NO/DEFAULT

  • If they called it with NO, distance sorts, and possibly distance queries probably won't work, because the {LatLonDocValuesField}} will not be added to the document

I'm not sure requiring "sortable" to be set to true in order to sort by distance to another point (as opposed to sorting by value of the field) is a good idea; I expect users to forget about it. But if we really need additional fields in order for distance sorts to work... I guess it's okay. Maybe we should at least make them sortable by default? If we don't need these LatLongDocValuesField for distance queries, however, we should definitely remove support for calling sortable(YES) on GeoPoint fields (throw an exception when that happens).

Also, we should check that potential NPE issue, and make sure to handle DEFAULT properly.

Do not forget to fix tests to not call sortable(YES) where it's not necessary.

Environment

None

Assignee

Fabio Massimo Ercoli

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure