Problem/Motivation

There is a bug on the actual solr schema which does not allow sorting multi-valued fields: #2038145: Sort multi-valued fields

In addition, it is better for stats to have a single value stored. This is done by the module apachesolr on its default indexing callback: http://drupalcode.org/project/apachesolr.git/blob/291d265cf700cf25521060...

Proposed resolution

Store a single value on the index, in addition to the multiple values.
This single value could be the first point (as it is done by the default apache indexing callback), or the centroid of the given points.

Comments

mac_weber’s picture

Adding patch to index the first value.

mac_weber’s picture

The already in code multi-valued field (geom_*) and the new single field (geos_*) will look like this in Solr:

    <arr name="geom_field_geocoordinates">
      <str>-19.930962519720197,-43.93831377848983</str>
      <str>-19.875665386120054,-43.92831713448614</str>
    </arr>
    <str name="geos_field_geocoordinates">-19.930962519720197,-43.93831377848983</str>
mac_weber’s picture

After talking with @phayes on IRC we decided to use centroid.
I rolled 2 new patches:

  • geofield-index_single_value_on_solr-2038433 uses 2 fields on Solr.
  • geofield-index_single_value_and_centroid_on_solr-2038433 uses 3 fields on Solr.

Right now we need only 2 fields, but using 3 fields we are starting to get ready to index shapes.
The 3 fields would be:

  1. Multi-valued field with all geometry(ies) points - as expected.
  2. A single field with the first (or the unique) point.
  3. A single field with centroid of the geometry(ies).

I also added the interdiff.

mac_weber’s picture

We've decided to use the 2 fields for now:

  1. Multi-valued solr field with all geometry(ies) points - as expected.
  2. A single-valuedsolr field with centroid of the geometry(ies), or the unique given point.
phayes’s picture

Status: Needs review » Fixed

Merged. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.