> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bigdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SortBy

The search results can be sorted either *by relevance* (best matching
results first) or *by date* (most recent results first), where the
default if not specified is *by relevance*. This is controlled by the
`sortby` parameter, where the possible values are either
`SortBy.RELEVANCE` or `SortBy.DATE`.

<Note>
  The SortBy parameter is only available in the SDK; the API sorts by relevance.
</Note>

Example:

```python highlight={12} theme={null}
from bigdata_client import Bigdata
from bigdata_client.query import Entity
from bigdata_client.daterange import RollingDateRange
from bigdata_client.models.search import SortBy

MICROSOFT = "228D42"

bigdata = Bigdata()
search = bigdata.search.new(
    query=Entity(MICROSOFT),
    date_range=RollingDateRange.LAST_THIRTY_DAYS,
    sortby=SortBy.DATE,
)

documents = search.run(2)
print(documents)
```
