@@ -289,9 +289,16 @@ private void initSearchCountMap() throws IOException {
289
289
searchCountMaps .clear ();
290
290
291
291
for (String field : fields ) {
292
+ int numEntries = (int ) lookups .get (field ).getCount ();
293
+ if (numEntries == 0 ) {
294
+ logger .log (Level .FINE , "Skipping creation of ChronicleMap for field " + field + " in directory "
295
+ + suggesterDir + " due to zero number of entries" );
296
+ continue ;
297
+ }
298
+
292
299
ChronicleMapConfiguration conf = ChronicleMapConfiguration .load (suggesterDir , field );
293
300
if (conf == null ) { // it was not yet initialized
294
- conf = new ChronicleMapConfiguration (( int ) lookups . get ( field ). getCount () , getAverageLength (field ));
301
+ conf = new ChronicleMapConfiguration (numEntries , getAverageLength (field ));
295
302
conf .save (suggesterDir , field );
296
303
}
297
304
@@ -301,12 +308,14 @@ private void initSearchCountMap() throws IOException {
301
308
try {
302
309
m = new ChronicleMapAdapter (field , conf .getAverageKeySize (), conf .getEntries (), f );
303
310
} catch (IllegalArgumentException e ) {
304
- logger .log (Level .SEVERE , "Could not create ChronicleMap due to invalid key size: "
305
- + conf .getAverageKeySize (), e );
311
+ logger .log (Level .SEVERE , "Could not create ChronicleMap for field " + field + " in directory "
312
+ + suggesterDir + " due to invalid key size ("
313
+ + conf .getAverageKeySize () + ") or number of entries: (" + conf .getEntries () + "):" , e );
306
314
return ;
307
315
} catch (Throwable t ) {
308
316
logger .log (Level .SEVERE ,
309
- "Could not create ChronicleMap, most popular completion disabled, if you are using "
317
+ "Could not create ChronicleMap for field " + field + " in directory "
318
+ + suggesterDir + " , most popular completion disabled, if you are using "
310
319
+ "JDK9+ make sure to specify: "
311
320
+ "--add-exports java.base/jdk.internal.ref=ALL-UNNAMED "
312
321
+ "--add-exports java.base/jdk.internal.misc=ALL-UNNAMED "
0 commit comments