@@ -38,32 +38,82 @@ export const repositoryInfoSchema = z.object({
3838 name : z . string ( ) ,
3939 displayName : z . string ( ) . optional ( ) ,
4040 webUrl : z . string ( ) . optional ( ) ,
41- } )
41+ } ) ;
42+
43+ // Many of these fields are defined in zoekt/api.go.
44+ export const searchStatsSchema = z . object ( {
45+ // The actual number of matches returned by the search.
46+ // This will always be less than or equal to `totalMatchCount`.
47+ actualMatchCount : z . number ( ) ,
48+
49+ // The total number of matches found during the search.
50+ totalMatchCount : z . number ( ) ,
51+
52+ // The duration (in nanoseconds) of the search.
53+ duration : z . number ( ) ,
54+
55+ // Number of files containing a match.
56+ fileCount : z . number ( ) ,
57+
58+ // Candidate files whose contents weren't examined because we
59+ // gathered enough matches.
60+ filesSkipped : z . number ( ) ,
61+
62+ // Amount of I/O for reading contents.
63+ contentBytesLoaded : z . number ( ) ,
64+
65+ // Amount of I/O for reading from index.
66+ indexBytesLoaded : z . number ( ) ,
67+
68+ // Number of search shards that had a crash.
69+ crashes : z . number ( ) ,
70+
71+ // Number of files in shards that we considered.
72+ shardFilesConsidered : z . number ( ) ,
73+
74+ // Files that we evaluated. Equivalent to files for which all
75+ // atom matches (including negations) evaluated to true.
76+ filesConsidered : z . number ( ) ,
77+
78+ // Files for which we loaded file content to verify substring matches
79+ filesLoaded : z . number ( ) ,
80+
81+ // Shards that we scanned to find matches.
82+ shardsScanned : z . number ( ) ,
83+
84+ // Shards that we did not process because a query was canceled.
85+ shardsSkipped : z . number ( ) ,
86+
87+ // Shards that we did not process because the query was rejected by the
88+ // ngram filter indicating it had no matches.
89+ shardsSkippedFilter : z . number ( ) ,
90+
91+ // Number of candidate matches as a result of searching ngrams.
92+ ngramMatches : z . number ( ) ,
93+
94+ // NgramLookups is the number of times we accessed an ngram in the index.
95+ ngramLookups : z . number ( ) ,
96+
97+ // Wall clock time for queued search.
98+ wait : z . number ( ) ,
99+
100+ // Aggregate wall clock time spent constructing and pruning the match tree.
101+ // This accounts for time such as lookups in the trigram index.
102+ matchTreeConstruction : z . number ( ) ,
103+
104+ // Aggregate wall clock time spent searching the match tree. This accounts
105+ // for the bulk of search work done looking for matches.
106+ matchTreeSearch : z . number ( ) ,
107+
108+ // Number of times regexp was called on files that we evaluated.
109+ regexpsConsidered : z . number ( ) ,
110+
111+ // FlushReason explains why results were flushed.
112+ flushReason : z . number ( ) ,
113+ } ) ;
42114
43115export const searchResponseSchema = z . object ( {
44- zoektStats : z . object ( {
45- // The duration (in nanoseconds) of the search.
46- duration : z . number ( ) ,
47- fileCount : z . number ( ) ,
48- matchCount : z . number ( ) ,
49- filesSkipped : z . number ( ) ,
50- contentBytesLoaded : z . number ( ) ,
51- indexBytesLoaded : z . number ( ) ,
52- crashes : z . number ( ) ,
53- shardFilesConsidered : z . number ( ) ,
54- filesConsidered : z . number ( ) ,
55- filesLoaded : z . number ( ) ,
56- shardsScanned : z . number ( ) ,
57- shardsSkipped : z . number ( ) ,
58- shardsSkippedFilter : z . number ( ) ,
59- ngramMatches : z . number ( ) ,
60- ngramLookups : z . number ( ) ,
61- wait : z . number ( ) ,
62- matchTreeConstruction : z . number ( ) ,
63- matchTreeSearch : z . number ( ) ,
64- regexpsConsidered : z . number ( ) ,
65- flushReason : z . number ( ) ,
66- } ) ,
116+ stats : searchStatsSchema ,
67117 files : z . array ( z . object ( {
68118 fileName : z . object ( {
69119 // The name of the file
@@ -90,6 +140,7 @@ export const searchResponseSchema = z.object({
90140 } ) ) ,
91141 repositoryInfo : z . array ( repositoryInfoSchema ) ,
92142 isBranchFilteringEnabled : z . boolean ( ) ,
143+ isSearchExhaustive : z . boolean ( ) ,
93144} ) ;
94145
95146enum RepoIndexingStatus {
0 commit comments