Search code examples
symfonydoctrineakeneo

How to query products in Akeneo API using an OR conditional


We are tryng to query products using the same value and verifying if that value exists in, at leaste, one of a set of attributes. All the exambples about addFilter() function, are interpreted as an AND condition.

Is there a way to search products in Akeneo using "OR" conditional?

For example: Given a value myValue, we want to serach products where identifier=myValue OR internal_reference=myValue. (myValue has the same value in both cases)


Solution

  • I have been talking with Akeneo User group and is not possible to use the standard search, but there are two possible ways to implement the search with an OR conditional:

    1. Do different searches and merge the results
    2. Create a package/component/add-on with a new endpoint (route + controller method) where you put the query you want to implement.

    I know this is not a super answer but I hope this could be useful for reducing the research time for others in the future :-)