Index product properties

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
nvindice
Posts: 27
Joined: 16 May 2019, 16:20

Index product properties

Post by nvindice » 21 May 2019, 06:44

Hi Aimeos,

how can I add product properties to the index, so that our customers can find a product eg. by it's SKU?
I tried to add

Code: Select all

product/property
to

Code: Select all

mshop.index.manager.standard.domains
, but it does not seem to work...

Thanks,
Nils

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Index product properties

Post by aimeos » 21 May 2019, 23:00

The product properties are not indexed because they can be queried directly - at least by the index manager. You can also add the necessary conditions in the 2019.x versions of the product frontend controller by using the compare() method. The only thing you have to do is to adapt the catalog lists HTML client and add the conditions for what you want to filter for.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

nvindice
Posts: 27
Joined: 16 May 2019, 16:20

Re: Index product properties

Post by nvindice » 22 May 2019, 06:05

I would love to use product properties for the keyword search, e.g. when the user searches for a SKU or MPC. Do you see any chances here, without losing too much performance?

(Using 2018.x currently...)

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Index product properties

Post by aimeos » 22 May 2019, 19:30

The loss in performance may be acceptable if you add conditions for filtering by some properties. It will add a JOIN to the mshop_product_property table. Just make sure the indexes from the mshop_product_property table are used.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

nvindice
Posts: 27
Joined: 16 May 2019, 16:20

Re: Index product properties

Post by nvindice » 24 May 2019, 12:24

Thank you for the reply. The query got incredibly slow after adding something like

Code: Select all

$expr = array(
	$filter->compare( '==', 'product.property.value', $input ),
	$filter->compare( '>', $cmpfunc, 0 )
);
$textConds = $filter->combine( '||', $expr );

$expr = array(
	$textConds,
	$filter->getConditions()
);
to addFilterText(). I need to add the condition there (at the FE product controller), because I use the OR combination here but want to preserve the other filter conditions (like for disabled products etc).

The query slows down from ~10ms to ~600ms. This absolutely looks like an index is missing, but I don't know why and what I could change.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Index product properties

Post by aimeos » 26 May 2019, 07:24

You didn't add the type of the property you are looking for so no index is used. Furthermore, OR conditions are really slow and it's better to do two queries if possible. If you are looking for a text, you should use "=~" as operator too
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply