Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected result #8

Closed
satanicman opened this issue May 4, 2022 · 2 comments
Closed

Unexpected result #8

satanicman opened this issue May 4, 2022 · 2 comments
Assignees
Labels
bug Something isn't working done Finished/Fixed

Comments

@satanicman
Copy link

Example:

$records = [
    1 => [
        'vendor' => 'Apple',
        'model' => 'Iphone X',
        'price' => 80999,
        'color' => 'white',
        'has_phones' => false,
        'cam_mp' => 20,
        'sale' => true,
    ],
    2 => [
        'vendor' => 'Apple',
        'model' => 'Iphone X Pro Max',
        'price' => 80999,
        'color' => 'black',
        'has_phones' => true,
        'cam_mp' => 40,
        'sale' => true,
    ],
    3 => [
        'vendor' => 'Samsung',
        'model' => 'Galaxy S20',
        'price' => 70599,
        'color' => 'yellow',
        'has_phones' => true,
        'cam_mp' => 105,
        'sale' => true,
    ],
    4 => [
        'vendor' => 'Samsung',
        'model' => 'Galaxy S20',
        'price' => 70599,
        'color' => 'black',
        'has_phones' => true,
        'cam_mp' => 105,
        'sale' => true,
    ],
    5 => [
        'vendor' => 'Samsung',
        'model' => 'Galaxy A5',
        'price' => 15000,
        'color' => 'black',
        'has_phones' => true,
        'cam_mp' => 12,
        'sale' => true,
    ],
    6 => [
        'vendor' => 'Xiaomi',
        'model' => 'MI 9',
        'price' => 26000,
        'color' => 'black',
        'has_phones' => true,
        'cam_mp' => 48,
        'sale' => false,
    ]
];
$index = new ArrayIndex();

foreach ($records as $id => $item) {
    $index->addRecord($id, $item);
}
$facets = new Search($index);
$filter = new ValueFilter('vendor');
$filter->setValue(['Test']);
$filter2 = new ValueFilter('color');
$filter2->setValue(['white']);
$result = $facets->find([$filter, $filter2]);

I expect empty result, because vendor 'Test' does not exist, but it's not

k-samuel added a commit that referenced this issue May 5, 2022
…ignored for searching with multiple filters.
@k-samuel k-samuel self-assigned this May 5, 2022
@k-samuel k-samuel added the bug Something isn't working label May 5, 2022
@k-samuel
Copy link
Owner

k-samuel commented May 5, 2022

Hello @satanicman. Thanks for bug reporting.
Issue fixed in lattest commit.

Please let me know If this fix is enough, I will release a new version.

@k-samuel k-samuel added the done Finished/Fixed label May 5, 2022
@satanicman
Copy link
Author

All work fine, thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done Finished/Fixed
Projects
None yet
Development

No branches or pull requests

2 participants