@@ -7,10 +7,7 @@ const async = require('async');
7
7
const SchemaCreator = require ( './SchemaCreator' ) ;
8
8
const versions = require ( '../package.json' ) . contributes . target . versions ;
9
9
10
- const MAX_DOCUMENTS = 30000 ;
11
-
12
10
let connectionParams = { } ;
13
- let saveConnectionInfo = { } ;
14
11
15
12
let _client = null ;
16
13
@@ -295,6 +292,16 @@ const shouldPackageBeAdded = (docPackage, includeEmptyCollection) => {
295
292
return true ;
296
293
} ;
297
294
295
+ const getSampleDocSize = ( count , recordSamplingSettings ) => {
296
+ if ( recordSamplingSettings . active === 'absolute' ) {
297
+ return Number ( recordSamplingSettings . absolute . value ) ;
298
+ }
299
+
300
+ const limit = Math . ceil ( ( count * recordSamplingSettings . relative . value ) / 100 ) ;
301
+
302
+ return Math . min ( limit , recordSamplingSettings . maxValue ) ;
303
+ } ;
304
+
298
305
const getIndexTypeData = ( typeName , {
299
306
indexName,
300
307
recordSamplingSettings,
@@ -315,13 +322,9 @@ const getIndexTypeData = (typeName, {
315
322
} ,
316
323
317
324
( response , searchData ) => {
318
- const per = recordSamplingSettings . relative . value ;
319
- const size = ( recordSamplingSettings . active === 'absolute' )
320
- ? recordSamplingSettings . absolute . value
321
- : Math . round ( response . count / 100 * per ) ;
322
- const count = size > MAX_DOCUMENTS ? MAX_DOCUMENTS : size ;
325
+ const size = getSampleDocSize ( response . count , recordSamplingSettings ) ;
323
326
324
- searchData ( null , count ) ;
327
+ searchData ( null , size ) ;
325
328
} ,
326
329
327
330
( size , getTypeData ) => {
0 commit comments