0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2,search/management/commands/reindex_solr.py,Command,handle,#Command#,36

Before Change


    def handle(self, *args, **options):
        slice_size = 1000
        num_sounds = Sound.objects.filter(processing_state="OK", moderation_state="OK").count()
        for i in range(0, num_sounds, slice_size):
            console_logger.info("Adding %i sounds to solr, slice %i", slice_size, i)
            try:
                // Get all sounds moderated and processed ok
                where = "sound.moderation_state = "OK" AND sound.processing_state = "OK" AND sound.id > %s"
                order_by = "sound.id ASC"
                sounds_qs = Sound.objects.bulk_query_solr(where, order_by, slice_size, (i, ))
                add_sounds_to_solr(sounds_qs)
            except SolrException as e:
                console_logger.error("failed to add sound batch to solr index, reason: %s", str(e))
                raise

        // Get all sounds that should not be in solr and remove them if they are
        sound_qs = Sound.objects.exclude(processing_state="OK", moderation_state="OK")
        for sound in sound_qs:
            delete_sound_from_solr(sound.id)  // Will only do something if sound in fact exists in solr

After Change


    def handle(self, *args, **options):
        // Get all sounds moderated and processed ok
        sounds_to_index = Sound.objects.filter(processing_state="OK", moderation_state="OK")
        console_logger.info("Reindexing %d sounds to solr", sounds_to_index.count())

        add_all_sounds_to_solr(sounds_to_index)

        // Get all sounds that should not be in solr and remove them if they are
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: MTG/freesound
Commit Name: 0f7bacc26eec44c9f00f5d7666c1f87f0e051ce2
Time: 2017-11-10
Author: andres.ferraro@upf.edu
File Name: search/management/commands/reindex_solr.py
Class Name: Command
Method Name: handle


Project Name: uber/ludwig
Commit Name: 7d9db23a389499c2764fb850cd19f853cc3e8565
Time: 2019-08-08
Author: smiryala@uber.com
File Name: ludwig/features/image_feature.py
Class Name: ImageBaseFeature
Method Name: add_feature_data


Project Name: uber/ludwig
Commit Name: 5667af96dade79ef77194d519182d4989494b3a4
Time: 2019-08-25
Author: smiryala@uber.com
File Name: ludwig/features/image_feature.py
Class Name: ImageBaseFeature
Method Name: add_feature_data