massiveart/MassiveSearchBundle

Mapping for the image-field missing in XmlDriver

Closed this issue · 5 comments

I'm playing around with this nice bundle and noticed that the image-fields of my search-index were empty even if I defined them. After digging through the code, it seems to me, that the mapping is missing.

With the following additions it works as expected:

diff --git a/Search/Metadata/Driver/XmlDriver.php b/Search/Metadata/Driver/XmlDriver.php
index bfc3f76..0e7f044 100644
--- a/Search/Metadata/Driver/XmlDriver.php
+++ b/Search/Metadata/Driver/XmlDriver.php
@@ -118,6 +118,7 @@ class XmlDriver extends AbstractFileDriver implements DriverInterface
             $indexMetadata->setTitleField($mapping['title']);
             $indexMetadata->setUrlField($mapping['url']);
             $indexMetadata->setDescriptionField($mapping['description']);
+            $indexMetadata->setImageUrlField($mapping['image']);

             foreach ($mapping['fields'] as $fieldName => $fieldData) {
                 $indexMetadata->addFieldMapping($fieldName, $fieldData);
@@ -148,6 +149,9 @@ class XmlDriver extends AbstractFileDriver implements DriverInterface
         $urlField = $this->getMapping($mapping, 'url');
         $indexMapping['url'] = $urlField;

+        $imageField = $this->getMapping($mapping, 'image');
+        $indexMapping['image'] = $imageField;
+
         $descriptionField = $this->getMapping($mapping, 'description');
         $indexMapping['description'] = $descriptionField;

Am I missing something or is this feature really missing in current master?

@dantleech do you have any idea why the image isnt there any more?

According to the changelog support was not added to the XML driver (we use the images feature with a Sulu specific driver).

I am not sure why it was not implemented as it would seem quite trivial. @benbender do you want to make a PR?

Yepp, I can prepare a PR early next week. Just wanted to be sure that I didn't miss something (again *g).

it seems for me also quite easy and straight forward (: would be really cool if you create a PR for that. Can i ask on which project you work?

Fixed by #86. Can be closed.