HomeDev guideAPI ReferenceGraphQL
Dev guideUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Ordering

Order the document results.

πŸ‘

Beta

The Optimizely Graph .NET Client is in beta. Contact your Customer Success Manager for information.

Use the OrderBy method in TypeQueryBuilder to order your result. The method OrderBy() has the following parameters:

  • OrderMode – An enumerator that sorts the value of a field in DESC (descending) or ASC (ascending) order.
  • Ranking – An enumerator used for sorting on scores. It contains the values RELEVANCE, SEMANTIC, BOOST_ONLY, and DOC. For how to use these options, see Optimizely Graph OrderBy .

You can order by multiple fields, for example:

var query = queryBuilder
.ForType<MyDocument>()
  .Fields(x=>x.Property1)
  .OrderBy(x=>x.Property1, OrderMode.ASC, Ranking.BOOST_ONLY)
  .OrderBy(x=>x.Property2, OrderMode.DESC)
.ToQuery()
.BuildQueries();