Skip to content

UIPQB-277 Define supported operators for marcDataType - #345

Merged
vashjs merged 6 commits into
masterfrom
UIPQB-277
Aug 11, 2026
Merged

UIPQB-277 Define supported operators for marcDataType#345
vashjs merged 6 commits into
masterfrom
UIPQB-277

Conversation

@vashjs

@vashjs vashjs commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

mod-fqm-manager reports dataType: "marcType" for every synthetic MARC column, regardless of whether it's a tag-only reference, a subfield, or an indicator target — so the frontend can't tell these apart from the reported dataType alone. This PR derives the correct operator set from the MARC field's name instead.

  • Added parseMarcSelector(fieldName) in marcFieldOperators.js, which parses a MARC field name (e.g. marc_245_ind1, marc_245_a, marc_245_ind1_1_ind2) into a { subfield, indicator1, indicator2 } shape, mirroring the grammar used by lib-fqm-query-processor's MarcFieldFactory. Handles:
    • all six supported forms (tag-only, subfield, indicator target, constrained subfield/indicator target with one or both indicators fixed, blank indicator values)
    • control field tags (001–009, no subfields/indicators)
    • composite entity-type source prefixes (marc_bib.marc_245_a)
    • case-insensitivity
  • isMarcIndicatorTarget classifies a parsed selector as targeting an indicator (a single coded character) vs. a subfield/tag.
    • Indicator targets get eq / ne / in / nin (no empty, since an indicator always holds a value)
    • Everything else gets the standard text operator set
  • getOperatorOptions (selectOptions.js) now accepts a raw fieldName and internally calls parseMarcSelector for MarcType fields, replacing the two call sites in query.js and RepeatableFields.js that previously duplicated the same dataType === DATA_TYPES.MarcType ? parseMarcSelector(...) : undefined gating check.
  • Extracted getDiscreteOrTextOperators in constants/operators.js — the shared eq/ne + (in/nin or contains/starts_with) + empty shape reused by both StringType (via hasSourceOrValues) and MarcType (via isMarcIndicatorTarget).
  • Added MarcType to DATA_TYPES.

Refs: UIPQB-277

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Jest Unit Test Results

  1 files  ± 0   22 suites  +1   1m 17s ⏱️ -1s
346 tests +30  345 ✅ +30  1 💤 ±0  0 ❌ ±0 
359 runs  +30  358 ✅ +30  1 💤 ±0  0 ❌ ±0 

Results for commit aae7f95. ± Comparison against base commit d1de340.

♻️ This comment has been updated with latest results.

@vashjs
vashjs marked this pull request as ready for review August 11, 2026 13:08
@vashjs vashjs added the ai label Aug 11, 2026
@vashjs
vashjs requested a review from bvsharp August 11, 2026 13:09
# Conflicts:
#	CHANGELOG.md
@sonarqubecloud

Copy link
Copy Markdown

@vashjs
vashjs merged commit 9554c3f into master Aug 11, 2026
15 checks passed
@vashjs
vashjs deleted the UIPQB-277 branch August 11, 2026 20:52
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