Adjusting "f_search" in Aimeos for Product Search Behavior

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!
randomdennis
Posts: 22
Joined: 10 Oct 2024, 12:51

Adjusting "f_search" in Aimeos for Product Search Behavior

Post by randomdennis » 10 Oct 2024, 12:56

Hi everyone,

I'm using Aimeos's JSONAPI with f_search and noticed something peculiar. When I search for "control sauna," I don't get any results, but when I search for "sauna control" I do. The products have the words "sauna" "saunacontrol" and "control" individually in the title or text.

I would like to adjust how f_search queries the database. Does anyone know where I can modify this behavior? I'm looking for both code-based and configuration-based solutions (e.g., Elastic vs. standard settings).

Thanks in advance for any help!

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

Re: Adjusting "f_search" in Aimeos for Product Search Behavior

Post by aimeos » 10 Oct 2024, 13:11

Where do you store the product index? MySQL, PostGreSQL, Solr or ElasticSearch?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star


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

Re: Adjusting "f_search" in Aimeos for Product Search Behavior

Post by aimeos » 10 Oct 2024, 14:15

The MySQL index text manager generates a "MATCH( mindte."content" ) AGAINST( '...' IN BOOLEAN MODE )" statement here:
https://github.com/aimeos/aimeos-core/b ... hp#L25-L30

You can set the log level to 7 (debug) and have a look into the Log panel of the admin backend which SQL statements are used:
https://github.com/aimeos/aimeos/blob/m ... p.php#L247

The MATCH statement should look like this:

Code: Select all

MATCH( mindte."content" ) AGAINST( 'control* sauna*' IN BOOLEAN MODE )
This should find products whose texts contain words starting with "control" or "sauna", so "saunacontrol" should be found provided the mshop_index_text.content column contains those words.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply