Merge remote-tracking branch 'origin/sub_laptop_4' into main_laptop_1

This commit is contained in:
2026-10-01 20:16:35 +09:00
2 changed files with 96 additions and 6 deletions
+7 -6
View File
@@ -298,18 +298,19 @@ def _squash(text: Any) -> str:
def _found(sub: str, detail: str, q: str) -> list[dict]:
"""범위(구분 · 상세구분) 안 · 띄어쓰기로 나눈 말을 모두(AND) 이름 · 규격 · 키 · 원문번호에서."""
words = [w.lower() for w in str(q or "").split()]
"""범위(구분 · 상세구분) 안 · 띄어쓰기로 나눈 말을 모두(AND) 이름 · 규격 · 키 · 원문번호에서.
품목 글 · 찾는 낱말 모두 띄어쓰기를 지우고 비교 — 「흄 관(B형)」 도 「흄관」 으로 걸림.
"""
words = [_squash(w) for w in str(q or "").split()]
numbers = _numbers()
rows = (store.loaded()[0].get(MATERIALS) or {}).get("줄") or []
out = []
for r in rows:
if (sub and r.get("구분") != sub) or (detail and r.get("상세구분") != detail):
continue
hay = " ".join(
str(x or "")
for x in (r.get("이름"), r.get("규격"), r.get("키"), numbers.get(r.get("키")))
).lower()
fields = (r.get("이름"), r.get("규격"), r.get("키"), numbers.get(r.get("키")))
hay = "|".join(_squash(x) for x in fields)
if all(w in hay for w in words):
out.append(r)
return out