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

Cursor selection (scroll search)

Select cursor value from Optimizely Graph.

👍

Beta

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

Cursor is useful when retrieving large amounts of documents. The backend system will preserve the results and response with the cursor value.

You get the cursor value from the query in the Optimizely Graph Client using the GetCursor method. Then, retrieve the subset of preserved documents using the SetCursor method.

The following is an example for scanning all documents in type MyDocument:

 var cursorQuery = queryBuilder
.ForType<MyDocument>()
  .GetCursor()
 .ToQuery()
 .BuildQueries();
//get cursor value
var cursor = cursorQuery.GetResultAsync<MyDocument>().Result.Content.First().Cursor;
//build the next sub-set query
var subsetQuery = queryBuilder
.ForType<MyDocument>()
  .SetCursor(cursor)
  .Field(x=> x.Name)
 .ToQuery()
 .BuildQueries();

var nextSubset = await subsetQuery.GetResultAsync<MyDocument>().Content.Hits;
while(nextSubset != null){
  //continue to get nextSubset until the result is null.
}