Refactored write_metadata.php to ignore empty searches.