// Index all those which are processed and moderated ok that has is_index_dirty
sounds_to_index = Sound.objects.filter(processing_state="OK", moderation_state="OK", is_index_dirty=True)
num_sounds = sounds_to_index.count()
logger.info("Starting posting dirty sounds to solr. %i sounds to be added/updated to the solr index"
% num_sounds)
num_correctly_indexed_sounds = add_all_sounds_to_solr(sounds_to_index)
if num_correctly_indexed_sounds == num_sounds:
sounds_to_index.update(is_index_dirty=False)
logger.info("Finished posting dirty sounds to solr. %i sounds have been added/updated"
% num_correctly_indexed_sounds)
// Remove all those which are not processed or moderated ok and that are still in solr (should not happen)