# Custom query matchMaker

**URL:** <https://forum.heroiclabs.com/t/custom-query-matchmaker/917>\
**Category:** Local Setup\
**Created:** [August 16, 2020, 10:16pm UTC](https://forum.heroiclabs.com/t/custom-query-matchmaker/917 "2020-08-16T22:16:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tranthor](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tranthor](https://forum.heroiclabs.com/u/tranthor)\
**Post date:** [August 16, 2020, 10:16pm UTC](https://forum.heroiclabs.com/t/custom-query-matchmaker/917/1 "2020-08-16T22:16:47Z")

</div>

Hi community,  
I’m using Nakama SDK in my game that’s developed in C++ with cocos2d-x.  
Currently I’m having problems with matchMaker. I’ll try to be brief:  
I’m using the method `addMatchmaker` for search players in the server and start playing.

When I do a matchMaker with `query = "*"` everything works, I find an opponent to play. But when I want to do a matchMaker with a **custom query** , I don’t find opponents.

For example, I’ve 2 players that are looking for opponents. Both players are in the matchMaker pool with the same query, this query:  
`query = "+nextRoundMatch:eedf6992-0f85-4a8a-9a25-624eab40ee95."`

But it doesn’t work. The callback `onMatchmakerMatchedCallback` is not called. And I don’t have an error related to matchMaker because this callback is called ok in both clients:

```auto
auto successCallbackMatchMaker = [](const NMatchmakerTicket &ticket)
{
};

```

I mean, both players are in the matchmaker pool but they don’t find each other despite of they have the same query.  
Is this feature working ? Or maybe I’m doing something wrong?

Thanks.

---

<div class="post-metadata">

**Author:** ![tranthor](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tranthor](https://forum.heroiclabs.com/u/tranthor)\
**Post date:** [August 24, 2020, 10:50pm UTC](https://forum.heroiclabs.com/t/custom-query-matchmaker/917/2 "2020-08-24T22:50:28Z")

</div>

Issue created on git: [https://github.com/heroiclabs/nakama-cpp/issues/33](https://github.com/heroiclabs/nakama-cpp/issues/33)

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [August 25, 2020, 9:23am UTC](https://forum.heroiclabs.com/t/custom-query-matchmaker/917/3 "2020-08-25T09:23:55Z")

</div>

@tranthor What properties are you specifying for your users when you add them to matchmaking? I assume you’ve submitted a string property for each user with the value key `"nextRoundMatch"` and the value `"eedf6992-0f85-4a8a-9a25-624eab40ee95."`

If all of that is fine then have a look at the [matchmaker query docs](https://heroiclabs.com/docs/gameplay-matchmaker/#query) for a few examples, you’ll see part of the query specification is a field namespace. Your query should look more like: `query = "+properties.nextRoundMatch:eedf6992\-0f85\-4a8a\-9a25\-624eab40ee95."`. Note also the escaped `-` characters, you can find more info on escaping queries in the [query string docs for Nakama’s embedded indexer](http://blevesearch.com/docs/Query-String-Query/).

---

<div class="post-metadata">

**Author:** ![tranthor](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tranthor](https://forum.heroiclabs.com/u/tranthor)\
**Post date:** [August 25, 2020, 11:53pm UTC](https://forum.heroiclabs.com/t/custom-query-matchmaker/917/4 "2020-08-25T23:53:58Z")

</div>

Thanks @zyro ! I fixed it.  
It worked without adding escaped `-` characters. So I assume that’s not necessary
