Skip to content

Commit b588f8f

Browse files
committed
Handle uppercase latest updates stopwords too + BUILD
1 parent 57ebaed commit b588f8f

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

indexer/scraper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ async def thread(id: int) -> dict[str, str] | f95zone.IndexerError | None:
8383
query = re.sub(r"\.+ | \.+", " ", query)
8484
for char in "?&/':;-":
8585
query = query.replace(char, " ")
86-
query = re.sub(r"\s+", " ", query).strip()
86+
query = re.sub(r"\s+", " ", query).strip()[:30]
8787
words = query.split(" ")
8888
for stopword in f95zone.LATEST_STOPWORDS:
89-
while stopword in words:
90-
words.remove(stopword)
89+
for word in words.copy():
90+
if word.lower() == stopword:
91+
words.remove(word)
9192
query = " ".join(words)
9293
for category in f95zone.LATEST_CATEGORIES:
9394

modules/api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,12 @@ def latest_updates_search_sanitize_query(query: str):
490490
query = re.sub(r"\.+ | \.+", " ", query)
491491
for char in "?&/':;-.":
492492
query = query.replace(char, " ")
493-
query = re.sub(r"\s+", " ", query).strip()
493+
query = re.sub(r"\s+", " ", query).strip()[:30]
494494
words = query.split(" ")
495495
for stopword in latest_updates_search_redis_stopwords:
496-
while stopword in words:
497-
words.remove(stopword)
496+
for word in words.copy():
497+
if word.lower() == stopword:
498+
words.remove(word)
498499
query = " ".join(words)
499500
return query
500501

0 commit comments

Comments
 (0)