# Custom single/multi selection fields doesn't indexed for search.

**URL:** <https://forum.shopware.com/t/custom-single-multi-selection-fields-doesnt-indexed-for-search/64540>\
**Category:** Programmierung\
**Created:** [7. Februar 2020 um 11:21 UTC](https://forum.shopware.com/t/custom-single-multi-selection-fields-doesnt-indexed-for-search/64540 "2020-02-07T11:21:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Master](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@Master](https://forum.shopware.com/u/Master)\
**Post date:** [7. Februar 2020 um 11:21 UTC](https://forum.shopware.com/t/custom-single-multi-selection-fields-doesnt-indexed-for-search/64540/1 "2020-02-07T11:21:01Z")

</div>

Hi everyone!  
Found some bug with search indexing for custom single/multi selection fields in core.

Scenario:  
Added the new field to&nbsp;Article’s attributes, let’s say “Country” (type: MULTI SELECTION, Entity: Country - Shopware\Models\Country\Country)  
The new Field added to search index&nbsp;by custom “SearchTermQueryBuilder”

```
public function buildQuery(ShopContextInterface $context, $term)
    {
        $query = $this->decoratedQueryBuilder->buildQuery($context, $term);
        $matchQuery = new MultiMatchQuery(['attributes.core.countries'], $term);
        $query->add($matchQuery, BoolQuery::SHOULD);
        return $query;
    }

```

Result:  
In Article details&nbsp;template avaibale only string&nbsp;with keys:&nbsp; &nbsp; countries = " **|2|3|4|**"  
_ProductProvider_ also&nbsp;got&nbsp; **|2|3|4|** in Article structure, and this wrong data transfered to Search index.

Expected:&nbsp; countries = “value value value-n …”

Does it possible transfer to search index content, not just KEYs from referenced Models?

Many thanks and have a good day.
