Fix in_(): quote string values to handle colons in Solr identifiers#141
Merged
Merged
Conversation
…fiers
String values passed to an IN filter were interpolated bare into the Solr
query string:
field:(value1 OR value2)
This breaks silently when any value contains a colon, e.g. a namespaced
identifier like `no.met.adc:fe10e5c9-a226-...`. Solr's query parser treats
the colon as a field separator, so `no.met.adc:fe10e5c9-...` becomes a
query on field `no.met.adc` with value `fe10e5c9-...`, which either matches
the wrong field or raises a syntax error.
Fix: wrap each string option in double quotes (escaping any embedded quotes),
producing:
field:("value1" OR "value2")
Numeric values are left unchanged (str(v) with no quotes).
This mirrors the quoting already applied in equality() for the same reason.
tomkralidis
approved these changes
May 26, 2026
tomkralidis
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
in_()interpolates option values bare into the Solr query string:This breaks silently when any value contains a colon. Solr's query parser
treats a bare colon as a field separator, so an identifier like
no.met.adc:fe10e5c9-a226-58be-829e-cfe5c3a3fc45is parsed as fieldno.met.adcwith value
fe10e5c9-..., which either silently matches the wrong field or raisesa Solr parse error (
undefined field no.met.adc).This is the same class of bug already fixed in
equality()— that fix wrapsthe RHS string in double quotes.
in_()was missed.Real-world case: STAC
POST /searchwith anidsorcollectionsfiltercontaining namespaced identifiers (common in OGC/ISO metadata catalogues that use
authority:uuidorscheme:localidconventions).Fix
Wrap each string option in double quotes, escaping any embedded double quotes.
Numeric values are left unchanged.
Produces:
which Solr parses correctly as phrase/term queries.
Context
Found while testing the MET Norway pycsw Solr plugin against a live STAC API
endpoint. Collection and item identifiers follow the
authority:uuidpatternthroughout the ADC/NBS/GCW Arctic metadata catalogues.
The companion fix in
equality()(already in main) uses the same quotingapproach for single-value equality comparisons; this PR extends it to
multi-value IN filters for consistency.
gh pr create
--repo geopython/pygeofilter
--base main
--head epifanio:fix/solr-backend-bugs
--title "Fix in_(): quote string values to handle colons and special characters in Solr identifiers"
--body-file /tmp/pygeofilter_pr_body.md 2>&1