# Manipulating Suggests and Searches without Elasticsearch

**URL:** <https://forum.shopware.com/t/manipulating-suggests-and-searches-without-elasticsearch/107737>\
**Category:** Programming (EN)\
**Created:** [14. August 2025 um 09:06 UTC](https://forum.shopware.com/t/manipulating-suggests-and-searches-without-elasticsearch/107737 "2025-08-14T09:06:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mingus](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@mingus](https://forum.shopware.com/u/mingus)\
**Post date:** [14. August 2025 um 09:06 UTC](https://forum.shopware.com/t/manipulating-suggests-and-searches-without-elasticsearch/107737/1 "2025-08-14T09:06:09Z")

</div>

Hello everyone!

I’m trying to control the order of products in Shopware 6’s search and suggest functionality based on a custom database field. The goal is for products with a higher value in this field to appear at the top.

Here’s what I’ve tried so far, without success. According to my logs, my subscriber is definitely being triggered, but I must be missing something — if it’s even possible at all.

**FieldSorting / Criteria Events (ProductSearchCriteriaEvent, ProductSuggestCriteriaEvent)**

- Idea: Use `FieldSorting` on the custom field.

- Problem: The custom field is not officially registered in Shopware.

- Result: Criteria events ignore the field; the sorting doesn’t work.

**Direct query access via Criteria (`getQuery()`)**

- Attempt: Manually add `ORDER BY msx_custom_ranking` via `getQuery()`.

- Problem: `getQuery()` does not exist on `ProductSearchCriteriaEvent` or `ProductSuggestCriteriaEvent`.

**Events ProductSearchResultEvent / ProductSuggestResultEvent**

- Idea: Sort the products after loading using a repository (`getSortedIdsForProducts()`) and then replace the elements via `$products->setElements()`.

- Problem: Even with the subscriber correctly triggered, the products were not sorted properly. Debug logs show the events fire, but the list remains unchanged.

**Repository**

- Idea: Use a combination of a repository and a modified subscriber.

- Problem: I haven’t found a working approach yet; apart from that, it’s tricky to write a proper search completely bypassing the DAL.

Unfortunately, none of this works. Does anyone have ideas or tips?

Thanks in advance!
