ad76d9b9f2442e0c938ef100415f35055b823c11,search/management/commands/post_dirty_sounds_to_solr.py,Command,handle,#Command#,32

Before Change


        sounds_dirty = Sound.objects.select_related("pack", "user", "license").filter(is_index_dirty=True)

        // Index all those which are processed and moderated ok
        sounds_dirty_to_index = sounds_dirty.filter(moderation_state="OK", processing_state="OK")
        logger.info("Starting posting dirty sounds to solr. %i sounds to be added/updated to the solr index"
                    % sounds_dirty_to_index.count())
        num_correctly_indexed_sounds = add_all_sounds_to_solr(sounds_dirty_to_index, mark_index_clean=True)
        logger.info("Finished posting dirty sounds to solr. %i sounds have been added/updated"

After Change



        num_correctly_indexed_sounds = 0
        slice_size = 1000
        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 that has is_index_dirty
                where = "sound.moderation_state = "OK" AND sound.processing_state = "OK" AND is_index_dirty = true 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)
                num_correctly_indexed_sounds += slice_size
            except SolrException as e:
                console_logger.error("failed to add sound batch to solr index, reason: %s", str(e))
                raise

        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)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


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


Project Name: dmlc/gluon-nlp
Commit Name: 03b0e7061cf477fbeccb9c128ee76603df582d86
Time: 2018-09-04
Author: leonard@lausen.nl
File Name: scripts/word_embeddings/evaluate_pretrained.py
Class Name:
Method Name: load_embedding_from_path


Project Name: CellProfiler/CellProfiler
Commit Name: 53059cec9053a8429b7f0a8f06e6cbe1672b60e7
Time: 2013-01-16
Author: leek@broadinstitute.org
File Name: cellprofiler/modules/tests/test_groups.py
Class Name: TestGroups
Method Name: test_02_01_group_on_one