@wrap_exceptions<EOL><INDENT>def upsert(self, doc, namespace, timestamp):<DEDENT>
if self.auto_commit_interval is not None:<EOL><INDENT>self.solr.add([self._clean_doc(doc, namespace, timestamp)],<EOL>commit=(self.auto_commit_interval == <NUM_LIT:0>),<EOL>commitWithin=u(self.auto_commit_interval))<EOL><DEDENT>else:<EOL><INDENT>self.solr.add([self._clean_doc(doc, namespace, timestamp)],<EOL>commit=False)<EOL><DEDENT>
Update or insert a document into Solr

        This method should call whatever add/insert/update method exists for
        the backend engine and add the document in there. The input will
        always be one mongo document, represented as a Python dictionary.