Search for a term in the docstore, and if found save.
(self, term: str)
| 239 | self.one_sentence = one_sentence |
| 240 | |
| 241 | def search(self, term: str) -> str: |
| 242 | """Search for a term in the docstore, and if found save.""" |
| 243 | result = self.docstore.search(term) |
| 244 | if self.one_sentence: |
| 245 | result = result.split(". ")[0] |
| 246 | if self.char_limit is not None: |
| 247 | result = result[: self.char_limit] |
| 248 | if isinstance(result, Document): |
| 249 | self.document = result |
| 250 | return self._summary |
| 251 | else: |
| 252 | self.document = None |
| 253 | return result |
| 254 | |
| 255 | async def asearch(self, term: str) -> str: |
| 256 | """Search for a term in the docstore, and if found save.""" |