# IsMainLocation Sort Clause

The [`Location\IsMainLocation` Sort Clause](https://doc.ibexa.co/en/latest/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-Values-Content-Query-SortClause-Location-IsMainLocation.html) sorts search results by whether their location is the main location of the content item.

Locations that aren't main locations are ranked as lower values (for example, with ascending order they're returned first).

## Arguments

- (optional) `sortDirection` - Query or LocationQuery constant, either `Query::SORT_ASC` or `Query::SORT_DESC`

## Limitations

The `Location\IsMainLocation` Sort Clause isn't available in [Repository filtering](https://doc.ibexa.co/en/latest/search/search_api/#repository-filtering).

## Example

```
$query = new LocationQuery();
$query->sortClauses = [new SortClause\Location\InMainLocation()];
```
