{NOTE: }
-
The Lucene indexing engine allows you to create your own Custom Sorters
where you can define how query results will be ordered based on your specific requirements. -
Use
PutServerWideSortersOperation
to deploy a custom sorter to the RavenDB server.
Once deployed, you can use it to sort query results for all queries made on all databases in your cluster. -
To deploy a custom sorter that will apply only to the database scoped to your Document Store,
see put custom sorter. -
A custom sorter can also be uploaded server-wide from the Studio.
-
In this page:
{NOTE/}
{PANEL: Put custom sorter server-wide}
-
First, create your own sorter class that inherits from the Lucene class Lucene.Net.Search.FieldComparator.
-
Then, send the custom sorter to the server using the
PutServerWideSortersOperation
.
{CODE-TABS} {CODE-TAB:csharp:Sync put_sorter@ClientApi\Operations\Server\Sorters\PutSorterServerWide.cs /} {CODE-TAB:csharp:Async put_sorter_async@ClientApi\Operations\Server\Sorters\PutSorterServerWide.cs /} {CODE-TABS/}
{NOTE: }
You can now order your query results using the custom sorter.
A query example is available here.
{NOTE/}
{PANEL/}
{PANEL: Syntax}
{CODE:csharp syntax_1@ClientApi\Operations\Server\Sorters\PutSorterServerWide.cs /}
Parameter | Type | Description |
---|---|---|
sortersToAdd | SorterDefinition[] |
One or more Sorter Definitions to send to the server |
{CODE syntax_2@ClientApi\Operations\Server\Sorters\PutSorterServerWide.cs /}
{PANEL/}