Problem/Motivation

When indexing a multi-value integer Search API field that is mapped to an Azure collection field, only the last value is sent to Azure.

For example, a multi-value taxonomy reference field such as field_tags can produce values like [3, 7, 12]. The document parameter builder currently treats non-AAIS field types as scalar fields and replaces the values array with end($field_values). Azure then receives only 12 instead of the full integer collection.

This makes filtering and faceting incomplete because documents are indexed with only one of their values.

Steps to reproduce

1. Install and configure Search API Azure AI Search.
2. Create a Search API index that includes a multi-value integer field, such as a taxonomy term reference field storing target IDs.
3. Ensure the Azure field is configured as an integer collection field.
4. Index an entity that has multiple values for that field.
5. Inspect the document sent to Azure or query/facet against the field.

Expected result:

Azure receives all integer values as an array, for example [3, 7, 12].

Actual result:

Azure receives only the last value, for example 12.

Proposed resolution

Preserve arrays for known multi-value integer fields that map to Azure collection fields, filter out empty values, and cast each remaining value to an integer before sending document parameters to Azure.

Attached patch:
preserve-multivalue-integer-collection-values.patch

Remaining tasks

1. Review the patch.
2. Consider whether the field detection should be generalized beyond the reproduced field name.
3. Add test coverage for multi-value integer collection indexing if the project has suitable test infrastructure.

User interface changes

None.

Introduced terminology

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kieran.cott created an issue. See original summary.

jacobsaw’s picture

StatusFileSize
new22.01 KB

Hi Kieran,

I am having trouble replicating the issue. I added a basic multi-value integer field, set "Integer Collection" in the Index field settings, and then indexed. I am seeing the following in my index within Azure:

 "field_int_collection": [
  5,
  3,
  6
],

During indexing, I can confirm my field hits line 140 of the DocumentsParamBuilder. Could you try debugging a bit more and confirm in your configuration the field has "type: aais.integer_collection"?

kieran.cott’s picture

Thanks for the speedy response @jacobsaw.

You're right that setting a basic multi-value integer field as "Integer Collection" results in the expected multi-value array in the Azure index.

It looks like this was a local configuration issue where field_tags was set as `type:integer` rather than `type: aais.integer_collection`.

Appreciate you providing the extra context - this issue can be closed as 'works as designed'.

Thanks again

kieran.cott’s picture

Status: Active » Closed (works as designed)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.