# Getting strange result querying carts when using multiple search filter groups [closed]

On Magento 2.0.6 community Using multiple filters to perform an AND operation, I'm getting very unexpected results.

Reproducable steps:

1) Successful GET call to search for abandoned carts with a simple 1 filter group (updated_at greater than equal 2016-06-14):

## .../rest/V1/carts/search?searchCriteria[filter_groups][0][filters][0][field]=updated_at&searchCriteria[filter_groups][0][filters][0][value]=2016-06-14&searchCriteria[filter_groups][0][filters][0][condition_type]=gteq

Result of Step 1: Assumed result is correct, it fetched 6 carts (3 Active, 3 InActive).

------------ 2) Performing a second query, adding an additional filter to narrow down the result (+ is_active equals true)

## .../rest/V1/carts/search?searchCriteria[filter_groups][0][filters][0][field]=updated_at&searchCriteria[filter_groups][0][filters][0][value]=2016-06-14&searchCriteria[filter_groups][0][filters][0][condition_type]=gteq&searchCriteria[filter_groups][1][filters][0][field]=is_active&searchCriteria[filter_groups][1][filters][0][value]=true&searchCriteria[filter_groups][1][filters][0][condition_type]=eq

Result of Step 2: Although POST transaction was successful, it fetched the exact opposite of what's expected, it returned the 3 carts whose is_active flags are false.

------------ 3) Changing the is_active filter value from true to false yielded the same 3 records whose is_active flags are FALSE (presumably generating a set of correct results).

Why did the the additional filter condition is_active eq true generate the wrong set of results?

Thanks!

## closed as unclear what you're asking by Amit Bera♦, Marius♦Jun 18 '16 at 11:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Let me try to summarize, when performing a search query for carts using a single filter condition "updated_at >= 2016-06-17". It returns 5 carts, 2 active, 3 Inactive. – immanuelp Jun 18 '16 at 22:52

I am fairly sure that you have encountered a bug that is similar to what has already been reported here as Repository Filter Groups Applied Inconsistently. I notice you have already reported your details as an issue on github as well. The code that should sort carts can be found in the getList method from the QuoteRepository here.

• That could be Kristoff. And, yes, I re-posted the question on stackexchange to see if anyone else has run into the issue. – immanuelp Jun 18 '16 at 22:58
• In my follow-up posting (summary description), it seems that there is a bug when M2 is applying those multiple filters, period. – immanuelp Jun 18 '16 at 23:04