Skip to content

Commit

Permalink
Merge pull request #18 from mustafakemalgilor/enhancement/run_search_…
Browse files Browse the repository at this point in the history
…tidbits

SearchTask::_run_search: small refactor
  • Loading branch information
dosaboy authored May 13, 2024
2 parents 18d375a + a0a69f7 commit c58410b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions searchkit/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,14 +1177,14 @@ def execute(self):
with gzip.open(path, 'rb') as fd:
try:
# test if file is gzip
fd.read(1)
fd.seek(0)
stats = self._run_search(fd)
self._flush_results_buffer()
fd.peek(1)
except OSError:
with open(path, 'rb') as fd:
stats = self._run_search(fd)
self._flush_results_buffer()
else:
stats = self._run_search(fd)
finally:
self._flush_results_buffer()
except UnicodeDecodeError:
log.exception("caught UnicodeDecodeError while searching %s", path)
raise
Expand Down

0 comments on commit c58410b

Please sign in to comment.