This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Extensions » eZ Find » eZFind Indexing of array of...
expandshrink

eZFind Indexing of array of CustomDataTypes

eZFind Indexing of array of CustomDataTypes

Thursday 13 March 2014 12:00:13 pm - 1 reply

Hello,

I do not know how to really set the indexing of an array of a customdatatype has to be set up.

My ez_class "product" has an attribute "variants". "variants" is an array of "ProductVariants". Every ProductVariant has a set of membervariables I need to index. But they still need to be linked to the Product so when I have a ProductA with a ProductVariant with the color red and a second ProductVariant with the color white and I search for the color red it should return Product A. Also when I search for the color white.

If I var_dump $content->dataMap()['variants']->attribute('content') of Product A. It returns

array(size=2)

0 => object ProductVariant...

1 => object ProductVariant...

I have created an own datatype handler for this based on ezfSolrDocumentFieldBase. With this I can handle a ProductVariant. But how can I array of them?

public static $subattributesDefinition = array(
        self:big-smile.gif EmoticonEFAULT_SUBATTRIBUTE => 'text',
        'color' => 'text',
        'material' => 'text',
        'product_code' => 'text',
        'ean_code' => 'text',
  );

getData() which returns an array like above with $content->dataMap()['variants']->attribute('content')[0] would work, but I must index all of $content->dataMap()['variants']->attribute('content') elements. Iterating over the array with foreach and returning

array(

1 => subattributesDefinition array

2 => subattributesDefinition array

)

This would return "Failed indexing product object with ID 12345" when I run updatesearchindexsolr.php.

What do I have to do to index such an array?

Best Regars,

Christian

Friday 25 April 2014 5:17:48 pm

Hi Christian, have you tried using ezfIndexPlugin custom plugins ?

You could have one that run a piece of code that adds custom fields for you "Product" type.

https://doc.ez.no/Extensions/eZ-Publish-extensions/eZ-Find/eZ-Find-2.7/Customization/General-Index-Time-Plugin-Mechanism

Then customising search to have it look in those fields as well

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from