Fixing search API

Fixing API crash if haystack returns deleted projects in database.