Skip to content

Commit

Permalink
Merge pull request #106 from Mik3Rizzo/main
Browse files Browse the repository at this point in the history
Windows lxml and decoding fixes
  • Loading branch information
Linbreux committed Feb 25, 2023
2 parents d174cdb + cc1c53c commit e36f266
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ requests==2.27.1
smmap==3.0.4
Werkzeug==1.0.1
idna==3.3
lxml==4.9.1
lxml==4.9.2
Whoosh==2.7.4
watchdog==2.1.9
cachelib==0.6.0
4 changes: 2 additions & 2 deletions search.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def index_all(self, wiki_directory: str, files: List[Tuple[str, str, str]]):
writer = AsyncWriter(self._index)
for path, title, relpath in files:
fpath = os.path.join(wiki_directory, relpath, path)
with open(fpath) as f:
with open(fpath, encoding="utf8") as f:
content = f.read()
content = self.textify(content)
writer.add_document(
Expand Down Expand Up @@ -126,7 +126,7 @@ def on_created(self, event: FileSystemEvent):
base_path, filename = os.path.split(file_path)
rel_path = self.rel_path(base_path)
title, _ = os.path.splitext(filename)
with open(file_path) as f:
with open(file_path, encoding="utf8") as f:
content = f.read()
self.search.index(rel_path, filename, title, content)

Expand Down

0 comments on commit e36f266

Please sign in to comment.