Skip to content

Commit

Permalink
bugfix tantivy query syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
c7nw3r committed Sep 6, 2023
1 parent 16a11ea commit 1f87b8f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion localsearch/searcher/tantivy_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,22 @@ def _canonicalize(self, text: str):
text = remove_punctuation(text)
text = remove_stopwords(text, self.config.lang)
text = lemmatize(text, self.config.lang)
text = '"' + text + '"'
text = text.replace("+", " ")
text = text.replace("-", " ")
text = text.replace("^", " ")
text = text.replace("`", " ")
text = text.replace(":", " ")
text = text.replace("{", " ")
text = text.replace("}", " ")
text = text.replace('"', " ")
text = text.replace("[", " ")
text = text.replace("]", " ")
text = text.replace("(", " ")
text = text.replace(")", " ")
text = text.replace("~", " ")
text = text.replace("!", " ")
text = text.replace("*", " ")
text = text.replace("\\", " ")
return text

def search_by_source(self, source: str, n: Optional[int] = None) -> List[Document]:
Expand Down

0 comments on commit 1f87b8f

Please sign in to comment.