I'm looking at how to add geolocation fields (https://www.drupal.org/project/geolocation) to an index (with a view to getting them to work with search_api_location...).

One stumbling block is that I need multiple fields on the index for a location query to work -- geolocation's Views filter expects the lat_sin, lat_cos, lng_rad to be present on the view.

Following the same pattern, what I was thinking to do for SearchAPI views is to have the geolocation field added as a whole to the index.

But the UI won't let me do this because the main property for the geolocation field is 'value', and that isn't found in the nested properties: so this code won't let the main field be added:

       $main_property = $property->getMainPropertyName();
       if ($main_property && isset($nested_properties[$main_property])) {
          $parent_child_type = $property->getDataType() . '.';
          $property = $nested_properties[$main_property];
          $parent_child_type .= $property->getDataType();
          unset($nested_properties[$main_property]);
          $can_be_indexed = TRUE;
        }

I suspect that is because geolocation module isn't correctly defining its field type in some way?

But even if that were fixed, I'm confused by the code above: if the main property were found to match a nested property, then only that one nested property is added.

Is there a way to cause all the nested properties of a field to get indexed?

Comments

joachim created an issue. See original summary.

veronicaSeveryn’s picture

Component: General code » Plugins
Priority: Normal » Major
Related issues: +#2731201: add support for SearchAPI views to CommonMap style plugin

Linking to the issue inside Geolocation module where someone provided a custom fix, which could be elaborated into a stable patch.

geek-merlin’s picture

Status: Active » Postponed (maintainer needs more info)

This looks solved now.

drunken monkey’s picture

Status: Postponed (maintainer needs more info) » Fixed

Then I guess you meant to set it to "Fixed"?

Status: Fixed » Closed (fixed)

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