om4r932 commited on
Commit
6d8484f
·
1 Parent(s): 1e31242

Fix only complete word problem

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -475,21 +475,21 @@ def search_spec(request: KeywordRequest):
475
  docValid = not isinstance(doc, str)
476
 
477
  if request.mode == "and":
478
- if all(kw in willLower(string, booleanLowered).split("+-+") for kw in kws):
479
  put = True
480
  if docValid:
481
  for chapter in list(doc.keys())[1:]:
482
  if "references" not in chapter.lower():
483
- if all(kw in willLower(doc[chapter], booleanLowered).split(" ") for kw in kws):
484
  put = True
485
  contents.append(chapter)
486
  elif request.mode == "or":
487
- if any(kw in willLower(string, booleanLowered).split("+-+") for kw in kws):
488
  put = True
489
  if docValid:
490
  for chapter in list(doc.keys())[1:]:
491
  if "references" not in chapter.lower():
492
- if any(kw in willLower(doc[chapter], booleanLowered).split(" ") for kw in kws):
493
  put = True
494
  contents.append(chapter)
495
 
 
475
  docValid = not isinstance(doc, str)
476
 
477
  if request.mode == "and":
478
+ if all(kw in willLower(string, booleanLowered) for kw in kws):
479
  put = True
480
  if docValid:
481
  for chapter in list(doc.keys())[1:]:
482
  if "references" not in chapter.lower():
483
+ if all(kw in willLower(doc[chapter], booleanLowered) for kw in kws):
484
  put = True
485
  contents.append(chapter)
486
  elif request.mode == "or":
487
+ if any(kw in willLower(string, booleanLowered) for kw in kws):
488
  put = True
489
  if docValid:
490
  for chapter in list(doc.keys())[1:]:
491
  if "references" not in chapter.lower():
492
+ if any(kw in willLower(doc[chapter], booleanLowered) for kw in kws):
493
  put = True
494
  contents.append(chapter)
495