Beispiel #1
0
 def do_action(self):
     reset_solr()
     msg_label = _("maintenance_reset_success",
                   default="SOLR index dropped")
     logger.info("##### SOLR Index dropped #####")
     api.portal.show_message(message=msg_label, request=self.request)
     return self.request.response.redirect("{}/@@solrpush-conf".format(
         api.portal.get().absolute_url()))
    def test_reset_solr(self):
        solr_results = search(query={'*': '*', 'b_size': 100000}, fl='UID')
        self.assertEqual(solr_results.hits, 0)

        api.content.transition(obj=self.unpublished_doc, transition='publish')
        commit()
        # try to push an indexable and published content
        push_to_solr(self.published_doc)
        push_to_solr(self.unpublished_doc)
        solr_results = search(query={'*': '*', 'b_size': 100000}, fl='UID')
        self.assertEqual(solr_results.hits, 2)
        self.assertEqual(solr_results.docs[0]['UID'], self.published_doc.UID())

        # cleanup catalog
        reset_solr()
        solr_results = search(query={'*': '*', 'b_size': 100000}, fl='UID')
        self.assertEqual(solr_results.hits, 0)
 def tearDown(self):
     set_registry_record('active', True, interface=IRerSolrpushSettings)
     reset_solr()