Exemple #1
0
    def handle(self, *args, **kwargs):
        index = WebappIndexer.get_index()
        doctype = WebappIndexer.get_mapping_type_name()
        es = WebappIndexer.get_es()

        apps = Webapp.objects.values_list('id', flat=True)

        missing_ids = []

        for app in apps:
            try:
                res = es.get(index, doctype, app, fields='id')
            except ElasticHttpNotFoundError:
                # App doesn't exist in our index, add it to `missing_ids`.
                missing_ids.append(app)

        if missing_ids:
            sys.stdout.write('Adding %s doc(s) to the index.'
                             % len(missing_ids))
            index_webapps.delay(missing_ids)
        else:
            sys.stdout.write('No docs missing from index.')
Exemple #2
0
    def handle(self, *args, **kwargs):
        index = WebappIndexer.get_index()
        doctype = WebappIndexer.get_mapping_type_name()
        es = WebappIndexer.get_es()

        apps = Webapp.objects.values_list('id', flat=True)

        missing_ids = []

        for app in apps:
            try:
                res = es.get(index, doctype, app, fields='id')
            except ElasticHttpNotFoundError:
                # App doesn't exist in our index, add it to `missing_ids`.
                missing_ids.append(app)

        if missing_ids:
            sys.stdout.write('Adding %s doc(s) to the index.' %
                             len(missing_ids))
            index_webapps.delay(missing_ids)
        else:
            sys.stdout.write('No docs missing from index.')
Exemple #3
0
 def setUp(self):
     super(TestFixupCommand, self).setUp()
     self.index = WebappIndexer.get_index()
     self.doctype = WebappIndexer.get_mapping_type_name()
     self.es = WebappIndexer.get_es()
     self.app = Webapp.objects.get(pk=337141)
Exemple #4
0
 def test_mapping_type_name(self):
     eq_(WebappIndexer.get_mapping_type_name(), 'webapp')
Exemple #5
0
 def test_mapping_type_name(self):
     eq_(WebappIndexer.get_mapping_type_name(), 'webapp')