make term similarity robust (#2212)

### What problem does this PR solve?


### Type of change

- [x] Performance Improvement
This commit is contained in:
Kevin Hu 2024-09-03 14:30:07 +08:00 committed by GitHub
parent 4d9e9f0dbb
commit 5a2c542ce2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -106,10 +106,9 @@ class EsQueryer:
m) for m in sm]
sm = [EsQueryer.subSpecialChar(m) for m in sm if len(m) > 1]
sm = [m for m in sm if len(m) > 1]
if len(sm) < 2:
sm = []
keywords.append(re.sub(r"[ \\\"']+", "", tk))
keywords.extend(sm)
if len(keywords) >= 12: break
tk_syns = self.syn.lookup(tk)