Hi,

I use geocoder 2.x-dev version (IDK if this module has been update vendor geocoder) and i got this error Drupal\Component\Plugin\Exception\PluginNotFoundException : The "-10" plugin does not exist. dans Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (ligne 52 de C:\wamp64\www\drupal-8.2.6\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php).

All seems to be ok with my patch, except your filter return all results with no distance selected, if I select 5 km or 10 km filter work as designed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Emerya.thomas created an issue. See original summary.

Musa.thomas’s picture

Issue summary: View changes

info

Musa.thomas’s picture

Issue summary: View changes
dbjpanda’s picture

FileSize
11.32 KB

I am getting the same error as well.
geocode error

dbjpanda’s picture

Status: Active » Needs work

@Emerya.thomas Could you explain me why did you remove below code snippets.

+++ b/src/Plugin/search_api/data_type/LocationDataType.php
@@ -15,22 +15,4 @@ use Drupal\search_api\DataType\DataTypePluginBase;
-  /**
-   * {@inheritdoc}
-   */
-  public function getValue($value) {
-    $geom = \geoPHP::load($value);
-
-    if ($geom) {
-      $centroid = $geom->getCentroid();
-      $lon = $centroid->getX();
-      $lat = $centroid->getY();
-
-      return "$lat,$lon";
-    }
-    else {
-      return $value;
-    }
-  }
-
dbjpanda’s picture

Submitted a patch for the above issue. It solves the error for me. Attached a screenshot as well.

dbjpanda’s picture

Status: Needs work » Needs review

Kindly review

Nick_vh’s picture

Status: Needs review » Needs work
  1. +++ b/src/Plugin/search_api_location/location_input/Geocode.php
    @@ -22,7 +22,7 @@ class Geocode extends LocationInputPluginBase {
    +    $geocoded_addresses = \Drupal::service('geocoder')->geocode($input['value'], $active_plugins);
    

    Doesn't $input['value'] need to be validated?

  2. +++ b/src/Plugin/search_api_location/location_input/Geocode.php
    @@ -40,7 +40,7 @@ class Geocode extends LocationInputPluginBase {
    +        $active_plugins[$id] = $id;
    

    Any reason why the weight was removed?

borisson_’s picture

Since we're touching the line where we're getting the geocoder from the container here, should we change this plugin to use proper DI instead? Not sure, that might have to go in a follow-up to this.

dbjpanda’s picture

Status: Needs work » Needs review
FileSize
2.32 KB
11.11 KB
12.66 KB

Kindly review the patch. Now geocoding provider plugin according their weight preference is working for me.
geocode providers
Output of the sorted and checked geocode providers plugins i.e $active_plugins array
sorted active plugins

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

  • Nick_vh committed c2a78a6 on 8.x-1.x authored by dbjpanda
    Issue #2867782 by dbjpanda, Emerya.thomas, borisson_: Fix geocoder break...
Nick_vh’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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