code: def add_document(self, question, answer):
          
          question = question.strip()
          answer = answer.strip()
  
          session = self.Session()
  
          if session.query(Document) \
                  .filter_by(text=question, answer=answer).count():
              logger.info('Already here: {0} -> {1}'.format(question, answer))
              return
          logger.info('add document: {0} -> {1}'.format(question, answer))
  
          grams = self._get_grams(session, question, make=True)
  
          doc = Document(question, answer)
          doc.grams = list(grams)
          self._recalc_idfs(session, grams)
  
          session.add(doc)
          session.commit()
docs: Add question answer set to DB.
  
          :param question: A question to an answer
          :type question: :class:`str`
  
          :param answer: An answer to a question
          :type answer: :class:`str`