zKillboard
zKillboard copied to clipboard
Logical bug in advanced search
Hi. Found an issue in advanced search: https://zkillboard.com/asearch/#{%22buttons%22:[%22togglefilters%22,%22alltime%22,%22rolling%22,%22attackers-and%22,%22either-and%22,%22victims-and%22,%22sort-date%22,%22sort-desc%22,%22page1%22,%22allinvolved%22],%22attackers%22:[{%22type%22:%22corporationID%22,%22id%22:98573740},{%22type%22:%22characterID%22,%22id%22:2113065022},{%22type%22:%22groupID%22,%22id%22:%22831%22}]} must show all kills for Zed's Motorcycle on Interceptors during he was in Rusty Hyenas corporation. But search shows kills like this one: https://zkillboard.com/kill/100172125/ with another Interceptor pilot. Before adding And/Or switches everything worked fine.
Thank you.
That search looks for killmails which (1) have Zed's Motorcycle as an attacker, AND (2) have a pilot from Rusty Hyenas corporation as an attacker, AND (3) have an interceptor as an attacker. The killmail you linked meets all those criterion.
What you are expecting is a search that look for one single attacker who (1) is Zed's Motorcycle AND (2) is in Rusty Hyenas corporation AND (3) is flying an interceptor, but that's not how the search works. It's not a bug, it's just not doing the same search you expect.
What you are expecting is a search that look for one single attacker who (1) is Zed's Motorcycle AND (2) is in Rusty Hyenas corporation AND (3) is flying an interceptor
Copy that. Is it possible to make this type of search?
It is definitely possible. There are two types of ANDs that are possible with these searches (1):
- Comparisons are happening within the same array (2) $and { attacker [ character, corporation ] }
- Comparisons are happening outside the same array (2) $and [ attacker { character }, attacker { corporation } ]
Prior to the and/or switch being added, the first option was being utilized. To help optimize the code assembling the search, the latter was implemented when the and/or switches were added. So, technically correct (the best kind of correct) is your assumption, AND the result currently seeing. It really depends on the end user's point of view.
I am thinking of adding an AAND (array and) that can be selected that would allow for the former search case to be implemented by request. This would really only apply to the attacker column as it wouldn't make much sense within the victim column since there can be only one victim per killmail.
(1) examples are pseudocode (2) it's more complicated than this and uses a different mongo $search command, but I'm attempting to KISS here
AAnd has been added that will combine the selections into a single array. And default to each selection being unique part of the search.