fix twelve channels search facets #4

Closed
shivani wants to merge 2 commits from twelve-channels into main
1 changed files with 16 additions and 0 deletions
Showing only changes of commit 054aa7a073 - Show all commits

View File

@ -293,6 +293,22 @@ class SearchRepository:
def _project_value(self, raw: Any, strategy: str) -> list[ProjectionValue]:
strategy = strategy.strip().lower()
raw_values = _flatten_projection_values(raw)
if strategy in ("multivalue", "comma_delimited", "delimited"):
split_values: list[str] = []
for item in raw_values:
if "," in item or ";" in item:
for token in item.replace(";", ",").split(","):
cleaned = token.strip().rstrip(".").strip()
if cleaned:
cleaned = cleaned[:1].upper() + cleaned[1:]
split_values.append(cleaned)
else:
cleaned = item.strip().rstrip(".").strip()
if cleaned:
cleaned = cleaned[:1].upper() + cleaned[1:]
split_values.append(cleaned)
raw_values = split_values
projected: list[ProjectionValue] = []
seen: set[str] = set()
for label in raw_values: