def getQueryResults(self, query, onlyLocal=False, onlyDistant=False): """builds and returns Result' instances by searching in the temporary table built for <qid> """ cursor = self._cnx.cursor() results = Result.selectWhere(cursor, query, onlyLocal, onlyDistant) cursor.close() return results
def pushDocuments(self, qid, documents, provider): """push <documents> into the temporary table built for <qid> """ cursor = self._cnx.cursor() try: for document in documents: res = Result.fromDocument(document, qid, provider) res.commit(cursor, update=False) cursor.close() self._cnx.commit() except: traceback.print_exc() self._cnx.rollback()