Uebernimm Enum-Listen und Filtergruppen in die Taxonomie, speichere Suchtreffer als Kandidaten und lasse CI das vorhandene API-Image nutzen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2117ca6b54
commit
68a8e3d945
23 files changed
+481
-118
No files matched your search
@@ -51,9 +51,7 @@ def _encode_mapping(mapping: dict[str, Any], criterion: dict[str, Any]) -> list[
|
||||
if encoding.get("encoding_type") == "RANGE_TOKEN":
|
||||
return _encode_range_token(mapping, criterion)
|
||||
if param == "xf":
|
||||
filter_key = str(mapping["external_filter_key"])
|
||||
source_value = _xf_value(mapping, criterion)
|
||||
return [("xf", f"{filter_key}_{_plus(source_value)}")]
|
||||
return _encode_xf(mapping, criterion)
|
||||
if param in {"minp", "maxp", "prmin", "prmax", "asuch", "fs"}:
|
||||
return [(param, str(criterion.get("value")))]
|
||||
template = encoding.get("value_template")
|
||||
@@ -112,10 +110,30 @@ def _lookup_option(mapping: dict[str, Any], value: Any) -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
def _encode_xf(mapping: dict[str, Any], criterion: dict[str, Any]) -> list[tuple[str, str]]:
|
||||
filter_key = str(mapping["external_filter_key"])
|
||||
raw = criterion.get("value")
|
||||
values = raw if isinstance(raw, list) else [raw]
|
||||
fragments: list[tuple[str, str]] = []
|
||||
for value in values:
|
||||
if value is None or value == "":
|
||||
continue
|
||||
source_value = _xf_value(mapping, {**criterion, "value": value})
|
||||
fragments.append(("xf", f"{filter_key}_{_plus(source_value)}"))
|
||||
if fragments:
|
||||
return fragments
|
||||
source_value = _xf_value(mapping, criterion)
|
||||
return [("xf", f"{filter_key}_{_plus(source_value)}")]
|
||||
|
||||
|
||||
def _xf_value(mapping: dict[str, Any], criterion: dict[str, Any]) -> str:
|
||||
looked_up = _lookup_option(mapping, criterion.get("value"))
|
||||
if looked_up is not None:
|
||||
return looked_up
|
||||
options = (mapping.get("encoding") or {}).get("options") or {}
|
||||
value = criterion.get("value")
|
||||
if options and value is not None and value != "":
|
||||
return str(value)
|
||||
return str(mapping.get("source_value") or _threshold_value(mapping, criterion))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user