Returns - list[str]: the list of documents with the idxs Input - list of idxs --------- - use the class-level connection object to retrieve the documents that have the idx in the input list of idxs. - retrieve and return these documents as a list
(self, idxs)
| 122 | return self._find_documents_with_idx(common_idx_of_docs) |
| 123 | |
| 124 | def _find_documents_with_idx(self, idxs): |
| 125 | """ |
| 126 | Returns - list[str]: the list of documents with the idxs |
| 127 | Input - list of idxs |
| 128 | --------- |
| 129 | - use the class-level connection object to retrieve the documents that |
| 130 | have the idx in the input list of idxs. |
| 131 | - retrieve and return these documents as a list |
| 132 | """ |
| 133 | idxs = list(idxs) |
| 134 | cur = self.conn.cursor() |
| 135 | sql = "SELECT document FROM IdToDoc WHERE id in ({seq})".format( |
| 136 | seq=",".join(["?"] * len(idxs)) |
| 137 | ) |
| 138 | result = cur.execute(sql, idxs).fetchall() |
| 139 | return result |
| 140 | |
| 141 | |
| 142 | if __name__ == "__main__": |