Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions isic/core/dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def es_query_or(s, loc, toks):
ret: dict[str, Any] = {"bool": {"should": []}}
for tok in toks[0]:
ret["bool"]["should"].append(tok)
toks[0] = ret
return ret


def q(s, loc, toks):
Expand Down Expand Up @@ -245,7 +245,7 @@ def q_or(s, loc, toks):
ret = Q()
for tok in toks[0]:
ret |= tok
toks[0] = ret
return ret


# Lucene DSL only supports uppercase AND/OR/TO
Expand Down
8 changes: 8 additions & 0 deletions isic/core/tests/test_dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
"public:true image_type:dermoscopic",
Q(public=True) & Q(accession__image_type="dermoscopic"),
),
(
"diagnosis_1:foobar OR (diagnosis_1:foobaz AND (diagnosis_1:foo* OR age_approx:50))",
Q(accession__diagnosis_1="foobar")
| (
Q(accession__diagnosis_1="foobaz")
& (Q(accession__diagnosis_1__startswith="foo") | Q(accession__age__approx=50))
),
),
],
)
def test_dsl_django_parser(query, filter_or_exception):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ dependencies = [
"pycountry==26.2.16",
"pydantic==2.13.4",
"pyexiv2==2.15.5",
"pyparsing==3.3.2",
"pyparsing==3.3.3",
"python-magic==0.4.27",
"pyyaml==6.0.3",
"requests==2.34.2",
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading