When performing an online session query in Unreal Engine, you have to update each search parameters like this:
SessionSearch = MakeShareable(new FOnlineSessionSearch());
SessionSearch->QuerySettings.Set(FName Key, <T> value); // set value for a key
Key is an FName, value type depends on what the key is for.
To access each setting, you need to know its FName key. You can’t search when you only know the bool variable name of the setting you want to change. I wasn’t able to find any information about this key/value system in the Unreal documentation, or anywhere else online, so I looked at the engine source.
Although you can get some indication of what they might be based on the comments in OnlineSessionSettings.h, the actual #define directives for each setting are hidden in Online/OnlineSessionNames.h
OnlineSessionNames.h excerpt
/** Search only for dedicated servers (value is true/false) */
#define SEARCH_DEDICATED_ONLY FName(TEXT("DEDICATEDONLY"))
/** Search for empty servers only (value is true/false) */
#define SEARCH_EMPTY_SERVERS_ONLY FName(TEXT("EMPTYONLY"))
/** Search for non empty servers only (value is true/false) */
#define SEARCH_NONEMPTY_SERVERS_ONLY FName(TEXT("NONEMPTYONLY"))
/** Search for secure servers only (value is true/false) */
#define SEARCH_SECURE_SERVERS_ONLY FName(TEXT("SECUREONLY"))
/** Search for presence sessions only (value is true/false) */
#define SEARCH_PRESENCE FName(TEXT("PRESENCESEARCH"))
/** Search for a match with min player availability (value is int) */
#define SEARCH_MINSLOTSAVAILABLE FName(TEXT("MINSLOTSAVAILABLE"))
/** Exclude all matches where any unique ids in a given array are present (value is string of the form "uniqueid1;uniqueid2;uniqueid3") */
#define SEARCH_EXCLUDE_UNIQUEIDS FName(TEXT("EXCLUDEUNIQUEIDS"))
/** User ID to search for session of */
#define SEARCH_USER FName(TEXT("SEARCHUSER"))
/** Keywords to match in session search */
#define SEARCH_KEYWORDS FName(TEXT("SEARCHKEYWORDS"))
/** The matchmaking queue name to matchmake in, e.g. "TeamDeathmatch" (value is string) */
#define SEARCH_MATCHMAKING_QUEUE FName(TEXT("MATCHMAKINGQUEUE"))
/** If set, use the named Xbox Live hopper to find a session via matchmaking (value is a string) */
#define SEARCH_XBOX_LIVE_HOPPER_NAME FName(TEXT("LIVEHOPPERNAME"))
/** Which session template from the service configuration to use */
#define SEARCH_XBOX_LIVE_SESSION_TEMPLATE_NAME FName(TEXT("LIVESESSIONTEMPLATE"))
/** Selection method used to determine which match to join when multiple are returned (valid only on Switch) */
#define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))
/** Whether to use lobbies vs sessions */
#define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))
what it actually means
| KEY | Meaning |
|---|---|
| SEARCH_DEDICATED_ONLY | Search only for dedicated servers (value is true/false) |
| SEARCH_EMPTY_SERVERS_ONLY | Search only for empty servers (value is true/false) |
| SEARCH_NONEMPTY_SERVERS_ONLY | Search for non-empty servers only (value is true/false) |
| SEARCH_SECURE_SERVERS_ONLY | Search for secure servers only (value is true/false) |
| SEARCH_PRESENCE | Search for presence sessions only (value is true/false) |
| SEARCH_MINSLOTSAVAILABLE | Search for a match with minimum player availability (value is int) |
| SEARCH_EXCLUDE_UNIQUEIDS | Exclude all matches where any unique IDs in a given array are present (value is string of the form “uniqueid1;uniqueid2;uniqueid3”) |
| SEARCH_USER | User ID to search for session of |
| SEARCH_KEYWORDS | Keywords to match in session search |
| SEARCH_MATCHMAKING_QUEUE | The matchmaking queue name to matchmake in, e.g. “TeamDeathmatch” (value is string) |
| SEARCH_XBOX_LIVE_HOPPER_NAME | If set, use the named Xbox Live hopper to find a session via matchmaking (value is a string) |
| SEARCH_XBOX_LIVE_SESSION_TEMPLATE_NAME | Which session template from the service configuration to use |
| SEARCH_SWITCH_SELECTION_METHOD | Selection method used to determine which match to join when multiple are returned (valid only on Switch) |
| SEARCH_LOBBIES | Whether to use lobbies vs sessions (value is true/false) |