Added database specific NULL field checks

This fixes searching with both MySQL and SQLite database backends