Skip to content

Add configurable default and parameter-based strategy selection for affiliation matching#526

Merged
jrhoads merged 3 commits intodevfrom
affilitation-default
Feb 26, 2026
Merged

Add configurable default and parameter-based strategy selection for affiliation matching#526
jrhoads merged 3 commits intodevfrom
affilitation-default

Conversation

@jrhoads
Copy link
Member

@jrhoads jrhoads commented Feb 26, 2026

Purpose

The purpose of this PR is to introduce a configurable default for the affiliation matching logic in the ROR API and allow users to explicitly choose between the single_search and multisearch matching methods via request parameters.

Approach

The logic in OrganizationViewSet has been updated to evaluate matching strategy based on a hierarchy:

  1. Explicit request parameters (single_search or multisearch).
  2. A global environment variable configuration (SINGLE_SEARCH_DEFAULT).
  3. Fallback to the legacy multisearch behavior.

Key Modifications

  • rorapi/settings.py: Added SINGLE_SEARCH_DEFAULT setting, controlled by an environment variable (defaults to False).
  • rorapi/common/views.py: Updated the list method in OrganizationViewSet to check for matching parameters and the new configuration setting.
  • rorapi/tests/tests_unit/tests_views_v2.py: Added a new test suite AffiliationDefaultMatchingTestCase to verify that the logic correctly identifies which matching function to call based on different settings and query parameters.

Important Technical Details

  • The multisearch parameter now acts as an explicit override to force the legacy matching logic even if SINGLE_SEARCH_DEFAULT is enabled.
  • The default behavior remains unchanged unless the environment variable SINGLE_SEARCH_DEFAULT is explicitly set to True.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Reviewer, please remember our guidelines:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@jrhoads jrhoads merged commit de7595e into dev Feb 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant