Add statuses and flags selection to advanced search

Fix search backend to use the new statuses