code: def refresh(self, thread=None):
          
          if not thread:
              thread = self._dbman._get_notmuch_thread(self._id)
  
          self._total_messages = thread.get_total_messages()
          self._notmuch_authors_string = thread.get_authors()
  
          subject_type = settings.get('thread_subject')
          if subject_type == 'notmuch':
              subject = thread.get_subject()
          elif subject_type == 'oldest':
              try:
                  first_msg = list(thread.get_toplevel_messages())[0]
                  subject = first_msg.get_header('subject')
              except IndexError:
                  subject = ''
          self._subject = subject
  
          self._authors = None
          ts = thread.get_oldest_date()
  
          try:
              self._oldest_date = datetime.fromtimestamp(ts)
          except ValueError:  # year is out of range
              self._oldest_date = None
          try:
              timestamp = thread.get_newest_date()
              self._newest_date = datetime.fromtimestamp(timestamp)
          except ValueError:  # year is out of range
              self._newest_date = None
  
          self._tags = {t for t in thread.get_tags()}
          self._messages = {}  # this maps messages to its children
          self._toplevel_messages = []
docs: refresh thread metadata from the index