Skip to content

Commit d64cd98

Browse files
author
Gerit Wagner
committed
simplify wos serializer
1 parent a761cd4 commit d64cd98

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

search_query/wos/serializer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# https://images.webofknowledge.com/images/help/WOS/hs_wos_fieldtags.html
1616

1717

18-
def to_string_wos(query: Query, wrap: bool = False) -> str:
18+
def to_string_wos(query: Query) -> str:
1919
"""Serialize the Query tree into a Web of Science (WoS) search string."""
2020

2121
# Leaf node
@@ -28,14 +28,14 @@ def to_string_wos(query: Query, wrap: bool = False) -> str:
2828
if child.operator and child.value == Operators.NOT:
2929
# Special handling: inject "NOT ..." directly
3030
not_child = child.children[0]
31-
not_str = to_string_wos(not_child, wrap=True)
31+
not_str = to_string_wos(not_child)
3232
parts.append(f"NOT {not_str}")
3333
else:
34-
parts.append(to_string_wos(child, wrap=True))
34+
parts.append(to_string_wos(child))
3535

3636
joined = f" {query.value} ".join(parts)
3737

38-
if wrap:
38+
if query.get_parent():
3939
field = query.search_field.value if query.search_field else ""
4040
return f"{field}({joined})"
4141

0 commit comments

Comments
 (0)