Skip to content

Commit

Permalink
Fix adding keys via CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Apr 29, 2024
1 parent aae0e96 commit 14faef3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions abcd/frontends/commandline/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,18 @@ def key_add(*, db, query, keys, **kwargs):
data = parser.parse(keys)

if query:
test = ("AND", query, ("OR", *(("NAME", key) for key in data.keys())))
if isinstance(db, OpenSearchDatabase):
test = [
f"{query} AND ({' OR '.join([f'{key}:*' for key in data.keys()])})"
for query in query
]
else:
test = ("AND", query, ("OR", *(("NAME", key) for key in data.keys())))
else:
test = ("OR", *(("NAME", key) for key in data.keys()))
if isinstance(db, OpenSearchDatabase):
test = ' OR '.join([f"{key}:*" for key in data.keys()])
else:
test = ("OR", *(("NAME", key) for key in data.keys()))

if db.count(query=test):
print(
Expand Down

0 comments on commit 14faef3

Please sign in to comment.