def reindex( self, pid ):
     ## access api
     api_root_url = unicode( os.environ['BELL_UCI__BDR_API_ROOT_URL'] )
     api_url = '%s/items/%s/' % ( api_root_url, pid )
     # self.logger.debug( '- in Reindexer.reindex(); api_url, %s' % api_url )
     r = requests.get( api_url )
     # self.logger.debug( '- in Reindexer.reindex(); partial response, %s' % r.content.decode('utf-8')[0:100] )
     ## validate accession_number
     ## validate bell_metadata
     ## get source data
     all_dict = r.json()
     # self.logger.debug( '- in Reindexer.reindex(); sorted(all_dict.keys()), %s' % sorted(all_dict.keys()) )
     bell_data_url = all_dict['links']['content_datastreams']['bell_metadata']
     self.logger.debug( '- in Reindexer.reindex(); bell_data_url, %s' % bell_data_url )
     r2 = requests.get( bell_data_url )
     bell_data_dict = r2.json()
     ## build initial post-dict
     bell_indexer = Indexer( self.logger )
     initial_solr_dict = bell_indexer.build_metadata_only_solr_dict( pid, bell_data_dict )
     # self.logger.debug( '- in Reindexer.reindex(); initial_solr_dict, %s' % pprint.pformat(initial_solr_dict) )
     ## update image data
     links_dict = all_dict['links']
     updated_solr_dict = bell_indexer.add_image_metadata( initial_solr_dict, links_dict )
     self.logger.debug( '- in Reindexer.reindex(); updated_solr_dict, %s' % pprint.pformat(updated_solr_dict) )
     ## validate dict
     validity = bell_indexer.validate_solr_dict( updated_solr_dict )
     self.logger.debug( '- in Reindexer.reindex(); validity for pid `%s`, %s' % (pid, validity) )
     ## update custom-solr
     if validity:
         post_result = bell_indexer.post_to_solr( updated_solr_dict )
         self.logger.debug( '- in Reindexer.reindex(); post_result for pid `%s`, %s' % (pid, post_result) )
 def remove_pid_from_custom_index( self, pid ):
     """  Removes entry from custom index. """
     idxr = Indexer( self.logger )
     response_status = idxr.delete_item( pid )
     assert response_status == 200, response_status
     return