Url parameter not working correctly

I have an url parameter to filter on a city name but with the city Ede it also shows the city Enschede. But when I filter on Enschede I only see Enschede. Why is this happening?

Url examples:
https://www.domain.com/nl/vacatures/?city=Enschede
https://www.domain.com/nl/vacatures/?city=Ede

The 3 letters “ede” are also found at the end of the name Enschede.

I guess you have to change your filter to compare the whole word and not just parts of it.

I was thinking something like that was causing it but I have no idea how to change the filter. At this moment it works like this since I have multiple TV filters.

&tvFilters=vacature_plaats==%[[!#GET.city]]%,werkgever_naam==%[[!#GET.employer]]%,vacature_dienstverband==%[[!#GET.employment]]%

Do the TVs vacature_plaats, werkgever_naam and werkgever_naam contain only 1 value, or can they also contain multiple values (usually divided by ||)?

Do you use getResources or pdoResources?

Only one, thanks for helping out!

Here is the documentation for tvFilters:

https://docs.modx.com/current/en/extras/getresources/index#using-tvfilters

To only find exact matches, delete the wildcard characters % (and maybe use the filter operator === instead).

&tvFilters=`vacature_plaats==[[!#GET.city]],...`

I think there is a problem, when not all 3 URL parameters are provided in the request.
Because LIKE '%%' matches every value and LIKE '' only matches empty strings.

I guess you have to create a custom snippet to generate the tvFilters-string with only the URL parameters that are present or alternatively use the default output modifier:

&tvFilters=`vacature_plaats==[[!#GET.city:default=`%%`]],werkgever_naam==[[!#GET.employer:default=`%%`]],vacature_dienstverband==[[!#GET.employment:default=`%%`]]`

Thanks, I should have looked into that a bit more. Simply removing the % did the trick.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.