Search After Usage

edit

Fluent DSL example

edit
s => s
.Sort(srt => srt
    .Descending(p => p.NumberOfCommits)
    .Descending(p => p.Name)
)
.SearchAfter(
    Project.First.NumberOfCommits,
    Project.First.Name
)

Object Initializer syntax example

edit
new SearchRequest<Project>()
{
    Sort = new List<ISort>
    {
        new FieldSort { Field = Field<Project>(p => p.NumberOfCommits), Order = SortOrder.Descending },
        new FieldSort { Field = Field<Project>(p => p.Name), Order = SortOrder.Descending }
    },
    SearchAfter = new List<object>
    {
        Project.First.NumberOfCommits,
        Project.First.Name,
    }
}

Example json output.

{
  "sort": [
    {
      "numberOfCommits": {
        "order": "desc"
      }
    },
    {
      "name": {
        "order": "desc"
      }
    }
  ],
  "search_after": [
    775,
    "Lesch Group"
  ]
}

Fluent DSL example

edit
s => s
.Sort(srt => srt
    .Descending(p => p.NumberOfCommits)
    .Descending(p => p.Name)
)
.SearchAfter(_previousSort)

Object Initializer syntax example

edit
new SearchRequest<Project>()
{
    Sort = new List<ISort>
    {
        new FieldSort { Field = Field<Project>(p => p.NumberOfCommits), Order = SortOrder.Descending },
        new FieldSort { Field = Field<Project>(p => p.Name), Order = SortOrder.Descending }
    },
    SearchAfter = _previousSort.ToList()
}

Example json output.

{
  "sort": [
    {
      "numberOfCommits": {
        "order": "desc"
      }
    },
    {
      "name": {
        "order": "desc"
      }
    }
  ],
  "search_after": [
    775,
    "Lesch Group"
  ]
}