Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 1.21 KB

CursorMark.md

File metadata and controls

32 lines (24 loc) · 1.21 KB

CursorMark

SolrNet supports efficient deep pagination via cursormark from Solr 4.7+.

Please make sure to read the documentation about the constraints when using cursor pagination.

Example: Make an initial Solr query using cursor pagination:

ISolrOperations<Document> solr = ...
var searchResults = solr.Query(SolrQuery.All, new QueryOptions {
    Rows = 10,
    StartOrCursor = StartOrCursor.Cursor.Start, // Sets initial state of the cursormark
    OrderBy = new[] {
        new SortOrder("uniqueField", Order.DESC), // Must sort on a unique field
        new SortOrder("anyOtherField", Order.ASC), // Optionally add any other fields for sorting
    }
});


// Make a new request while paging using the received cursormark from previous request

var pagedResults = solr.Query(SolrQuery.All, new QueryOptions {
    Rows = 100,
    StartOrCursor = searchResults.NextCursorMark,
    OrderBy = new[] {
        new SortOrder("uniqueField", Order.DESC), // Must sort on a unique field
        new SortOrder("anyOtherField", Order.ASC), // Optionally add any other fields for sorting
    }
});