@@ -12,15 +12,26 @@ public class LuceneQueryOptions : QueryOptions
12
12
/// </summary>
13
13
/// <param name="skip">Number of result documents to skip.</param>
14
14
/// <param name="take">Optional number of result documents to take.</param>
15
- /// <param name="searchAfter">Optionally skip to results after the results from the previous search execution. Used for efficent deep paging.</param>
16
- /// <param name="trackDocumentMaxScore">Whether to track the maximum document score. For best performance, if not needed, leave false.</param>
15
+ /// <param name="searchAfter">Optionally skip to results after the results from the previous search execution. Used for efficient deep paging.</param>
17
16
/// <param name="trackDocumentScores">Whether to Track Document Scores. For best performance, if not needed, leave false.</param>
18
- public LuceneQueryOptions ( int skip , int ? take = null , SearchAfterOptions searchAfter = null , bool trackDocumentScores = false , bool trackDocumentMaxScore = false )
17
+ /// <param name="trackDocumentMaxScore">Whether to track the maximum document score. For best performance, if not needed, leave false.</param>
18
+ /// <param name="skipTakeMaxResults">When using Skip/Take (not SearchAfter) this will be the maximum data set size that can be paged.</param>
19
+ /// <param name="autoCalculateSkipTakeMaxResults">If enabled, this will pre-calculate the document count in the index to use for <see cref="SkipTakeMaxResults"/>.</param>
20
+ public LuceneQueryOptions (
21
+ int skip ,
22
+ int ? take = null ,
23
+ SearchAfterOptions searchAfter = null ,
24
+ bool trackDocumentScores = false ,
25
+ bool trackDocumentMaxScore = false ,
26
+ int skipTakeMaxResults = AbsoluteMaxResults ,
27
+ bool autoCalculateSkipTakeMaxResults = false )
19
28
: base ( skip , take )
20
29
{
30
+ SearchAfter = searchAfter ;
21
31
TrackDocumentScores = trackDocumentScores ;
22
32
TrackDocumentMaxScore = trackDocumentMaxScore ;
23
- SearchAfter = searchAfter ;
33
+ SkipTakeMaxResults = skipTakeMaxResults ;
34
+ AutoCalculateSkipTakeMaxResults = autoCalculateSkipTakeMaxResults ;
24
35
}
25
36
26
37
/// <summary>
@@ -34,8 +45,26 @@ public LuceneQueryOptions(int skip, int? take = null, SearchAfterOptions searchA
34
45
public bool TrackDocumentMaxScore { get ; }
35
46
36
47
/// <summary>
37
- /// Options for Searching After. Used for efficent deep paging.
48
+ /// Options for Searching After. Used for efficient deep paging.
49
+ /// </summary>
50
+ public SearchAfterOptions SearchAfter { get ; } = null ;
51
+
52
+ /// <summary>
53
+ /// When using Skip/Take (not SearchAfter) this will be the maximum data set size that can be paged.
54
+ /// </summary>
55
+ /// <remarks>
56
+ /// For performance reasons, this should be low.
57
+ /// The default is 10k and if larger datasets are required to be paged,
58
+ /// this value can be increased but it is recommended to use the SearchAfter feature instead.
59
+ /// </remarks>
60
+ public int SkipTakeMaxResults { get ; }
61
+
62
+ /// <summary>
63
+ /// If enabled, this will pre-calculate the document count in the index to use for <see cref="SkipTakeMaxResults"/>.
38
64
/// </summary>
39
- public SearchAfterOptions SearchAfter { get ; }
65
+ /// <remarks>
66
+ /// This will incur a performance hit on each search execution since there will be a query to get the total document count.
67
+ /// </remarks>
68
+ public bool AutoCalculateSkipTakeMaxResults { get ; }
40
69
}
41
70
}
0 commit comments