Skip to content

Commit

Permalink
Lucene.Net.Search.Suggest.Fst.ExternalRefSorter: Changed temp path ge…
Browse files Browse the repository at this point in the history
…neration to use FileSupport.CreateTempFile() with named prefix and extension because it more closely matches Lucene and makes the files more easily identifiable.
  • Loading branch information
NightOwl888 committed Nov 1, 2022
1 parent 4166765 commit c076e40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Lucene.Net.Suggest/Suggest/Fst/ExternalRefSorter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Lucene.Net.Util;
using Lucene.Net.Support.IO;
using Lucene.Net.Util;
using System;
using System.IO;

Expand Down Expand Up @@ -39,7 +40,7 @@ public class ExternalRefSorter : IBytesRefSorter, IDisposable
public ExternalRefSorter(OfflineSorter sort)
{
this.sort = sort;
this.input = new FileInfo(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
this.input = FileSupport.CreateTempFile("RefSorter-", ".raw", OfflineSorter.GetDefaultTempDir());
this.writer = new OfflineSorter.ByteSequencesWriter(input);
}

Expand All @@ -58,7 +59,7 @@ public virtual IBytesRefEnumerator GetEnumerator()
{
CloseWriter();

sorted = new FileInfo(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
sorted = FileSupport.CreateTempFile("RefSorter-", ".sorted", OfflineSorter.GetDefaultTempDir());
sort.Sort(input, sorted);

input.Delete();
Expand Down

0 comments on commit c076e40

Please sign in to comment.