zKillboard icon indicating copy to clipboard operation
zKillboard copied to clipboard

Logical bug in advanced search

Open tigranm75 opened this issue 2 years ago • 3 comments

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.

tigranm75 avatar Apr 15 '22 22:04 tigranm75

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.

aebe avatar Apr 17 '22 00:04 aebe

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?

tigranm75 avatar Apr 17 '22 19:04 tigranm75

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

cvweiss avatar Apr 18 '22 12:04 cvweiss

AAnd has been added that will combine the selections into a single array. And default to each selection being unique part of the search.

cvweiss avatar Sep 24 '22 17:09 cvweiss