Skip to content

fix(search): answer text on numeric and date fields the same on both engines - #4122

Merged
fschade merged 1 commit into
mainfrom
fix/search-typed-field-values
Nov 25, 2026
Merged

fschade merged 1 commit into
mainfrom
fix/search-typed-field-values

Conversation

@dschmidt

Copy link
Copy Markdown
Contributor

A text value on a numeric or date field now gets the same answer from bleve and OpenSearch.

Before, size:>100 and size:50..500 found nothing on bleve and failed the whole search on OpenSearch with a number format exception. size=50 only matched on OpenSearch. Old iOS clients still send the colon form size:>100.

  • A number on a numeric field matches as a whole, with : and with = (size:50, size=50, audio.duration:200).
  • Anything that is no number matches nothing (size:>100, size:50..500, size:5*, audio.duration:long), and so does text on a date field (mtime:>2021-01-01).
  • The range operator .. stays unsupported, it now answers with no match instead of an error.

FieldIsNumeric and the new FieldIsDatetime read from one table of field types, built from the walk the mapping validation already uses. That replaces mapping.NumericFields from #4096.

One behaviour change comes with that: the parts of a location count as numeric fields, so location.altitude>1000 matches. They are indexed as numbers next to the geopoint in both engines, the previous walk skipped them.

The parity suite covers >=, <=, combined ranges, number equality, the colon forms and the location parts.

…engines

A text restriction on a numeric field reached the engines as is. bleve found nothing for size:>100 or size:50..500, OpenSearch failed the search with a number format exception. size=50 only matched on OpenSearch.

Both engines now read the value of such a restriction as a number and match it as a whole, with : and with =. Anything that is no number matches nothing, and so does text on a date field. size:>100 is not KQL, the range form is size>100; old iOS clients still send the colon form.

The field type comes from one table of all fields, built from the walk the mapping validation uses. It replaces the separate walk for numeric fields, which left out the parts of a location: location.altitude>1000 now matches, the parts are indexed as numbers next to the geopoint.

The parity suite covers >=, <=, combined ranges, number equality, the colon forms and the location parts.
@codacy-production

codacy-production Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity

Metric Results
Complexity 10

View in Codacy

🟢 Coverage 82.14% diff coverage · +0.04% coverage variation

Metric Results
Coverage variation ✅ +0.04% coverage variation (-1.00%)
Diff coverage ✅ 82.14% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (9ebb6a7) 95214 29578 31.06%
Head commit (c3a08d8) 95231 (+17) 29617 (+39) 31.10% (+0.04%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4122) 56 46 82.14%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@dschmidt dschmidt self-assigned this Nov 25, 2026
@dschmidt
dschmidt requested review from aduffeck and fschade November 25, 2026 10:22
@dschmidt
dschmidt marked this pull request as ready for review November 25, 2026 10:22
@fschade
fschade merged commit 98b9dec into main Nov 25, 2026
61 of 62 checks passed
@fschade
fschade deleted the fix/search-typed-field-values branch November 25, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants