diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-17 11:47:54 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-06-17 11:51:37 +0200 |
commit | a40f985557975eaf4987925724b09c46f6decaf6 (patch) | |
tree | b380007da1aab4d2e9934b6f878707950d1f28bf /ishtar_common/models_common.py | |
parent | 7ecbd4831e706691e7d0204976d56630f2c9d113 (diff) | |
download | Ishtar-a40f985557975eaf4987925724b09c46f6decaf6.tar.bz2 Ishtar-a40f985557975eaf4987925724b09c46f6decaf6.zip |
🐛 searches - raw search index: better management of terms with spaces
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 13447a4d3..bb786d48d 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -1013,6 +1013,7 @@ class FullSearch(models.Model): SEPS = [" ", "-", "/"] values = [] # split ID terms + # MNP 1995-1-1/42 -> ("MNP", "1995", "1", "42") for idx, sep in enumerate(SEPS): if not idx: values = value.split(sep) @@ -1021,9 +1022,13 @@ class FullSearch(models.Model): for val in values: new_values += val.split(sep) values = new_values + # stock also ID with separators + # MNP 1995-1-1 -> ("MNP", "1995-1-1") + for v in value.split(" "): + if v not in values: + values.append(v) + values = list(set(values)) for val in values: - if len(val) < 2: - continue val = val.replace("'", "").lower() result.append(f"'{val}':1") return result |