Filter apis

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!
traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Filter apis

Post by traiyani75 » 29 Sep 2020, 12:24

Hello,

We need to filter data based on text. We have tried with filter[f_search]. But, that is not well. It is searching from all text fields and also it searched for individual character. We need to search full string and in product name only.

So, we have check filter[~=][product.lable]. It is working fine. But, Again we have two language then it is creating issue. So, Can we use this filter ([~=]) into text content only? Right now it is working with product.lable.

example: this is working fine
{endpoints}+"/jsonapi/product?filter[~=][content]=Hitachi washing&include=text"

We need to use same condition for text.content field into included array.

regards
Tejas

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

Re: Filter apis

Post by aimeos » 29 Sep 2020, 13:57

You can try

Code: Select all

&filter[~=][index.text:name("en")]=Hitachi washing
but please be aware that the "~=" operator is extremely slow becaus it uses no indexes!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Filter apis

Post by traiyani75 » 30 Sep 2020, 13:58

So, from listed operators, which one is fastest?

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

Re: Filter apis

Post by aimeos » 30 Sep 2020, 14:00

The "==" or "=~" operator uses indexes and are fast.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Filter apis

Post by traiyani75 » 01 Oct 2020, 10:07

ok thanks

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Filter apis

Post by traiyani75 » 26 Nov 2020, 09:03

Hello, we are using f_search parameter on api request. But that is searching from all text fields. So, we are not getting very precise result on first positions.

While, if we check same thing on demo website on laravel platform, search results are very good.
How can we prepare api which return accurate results?

Currently we are calling this {endpoints-product}?sort=relevance&filter[f_search]=gas%20detector&include=text,media

On this api, Product with name : Gas detector is coming at end. And other products returns first cause those product has gas keyword into description.

Thanks in advance :)

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

Re: Filter apis

Post by aimeos » 27 Nov 2020, 13:18

What happens if your remove "sort=relevance"?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

traiyani75
Advanced
Posts: 114
Joined: 08 Nov 2019, 11:56

Re: Filter apis

Post by traiyani75 » 27 Nov 2020, 14:38

It is returning same result.

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

Re: Filter apis

Post by aimeos » 30 Nov 2020, 12:55

The 2020.10 LTS version used in the Laravel demo returns correct order by relevance:
https://laravel.demo.aimeos.org/default ... retty=true

There had been some improvements in 2020.07 and 2020.10 regarding ranking IIRC.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply