Skip to content

Commit 11a485d

Browse files
magnaremMagnar Eivind Martinsen
andauthored
Added escaping of In operator values to avoid solr error if the value contains reserved solr specific characters (#137)
Co-authored-by: Magnar Eivind Martinsen <magnar.eivind.martinsen@met.no>
1 parent b6209a0 commit 11a485d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pygeofilter/backends/solr/evaluate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from typing import Optional
3737

3838
import shapely.wkt
39+
import json
3940
from packaging.version import Version
4041
from pygeoif import shape
4142

@@ -205,7 +206,7 @@ def in_(self, node, lhs, *options):
205206
"""
206207
Creates a terms query for `IN` conditions.
207208
"""
208-
options_str = " OR ".join(str(option) for option in options)
209+
options_str = " OR ".join(json.dumps(str(option)) for option in options)
209210
terms_query = f"{lhs}:({options_str})"
210211
if node.not_:
211212
# Negate the terms query for NOT IN

0 commit comments

Comments
 (0)