Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev guideRecipesAPI Reference
Dev guideUser GuidesLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Order

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();