@@ -70,7 +70,7 @@ class SuggesterProjectData implements Closeable {
70
70
71
71
private static final int MAX_TERM_SIZE = Short .MAX_VALUE - 3 ;
72
72
73
- private static final String TEMP_DIR_PREFIX = "opengrok " ;
73
+ private static final String TEMP_DIR_PREFIX = "opengrok_suggester " ;
74
74
75
75
private static final String WFST_FILE_SUFFIX = ".wfst" ;
76
76
@@ -98,6 +98,8 @@ class SuggesterProjectData implements Closeable {
98
98
99
99
private Set <String > fields ;
100
100
101
+ private final Path tempDir ;
102
+
101
103
SuggesterProjectData (
102
104
final Directory indexDir ,
103
105
final Path suggesterDir ,
@@ -108,6 +110,8 @@ class SuggesterProjectData implements Closeable {
108
110
this .suggesterDir = suggesterDir ;
109
111
this .allowMostPopular = allowMostPopular ;
110
112
113
+ tempDir = Files .createTempDirectory (TEMP_DIR_PREFIX );
114
+
111
115
initFields (fields );
112
116
}
113
117
@@ -207,7 +211,7 @@ private WFSTCompletionLookup loadStoredWFST(final File file) throws IOException
207
211
}
208
212
209
213
private WFSTCompletionLookup createWFST () throws IOException {
210
- return new WFSTCompletionLookup (FSDirectory .open (Files . createTempDirectory ( TEMP_DIR_PREFIX ) ), TEMP_DIR_PREFIX );
214
+ return new WFSTCompletionLookup (FSDirectory .open (tempDir ), TEMP_DIR_PREFIX );
211
215
}
212
216
213
217
private File getWFSTFile (final String field ) {
@@ -446,6 +450,8 @@ public void close() throws IOException {
446
450
}
447
451
});
448
452
indexDir .close ();
453
+
454
+ FileUtils .deleteDirectory (tempDir .toFile ());
449
455
} finally {
450
456
lock .writeLock ().unlock ();
451
457
}
0 commit comments