amartens181 opened a new issue #360:
URL: https://github.com/apache/lucenenet/issues/360
### Expected Outcome:
There would be a way to persist an index built by the suggester.
### What I See:
The index is never commited, so the index created is one-time use. I had been using `RamDirectory`
to store it since I was not indexing much, but now I want to persist it now.
### How To Recreate:
Build an `AnalyzingInfixSuggester`. Without using reflection, there's no way of finalizing
the index to disk.
### Other Info:
The ability to commit the index was added in 4.11.0, but the inability to do so in 4.8.0
without reflection seems like a usability bug.
Java commit code: https://github.com/apache/lucene-solr/commit/4a485d68771e5e123139cc12e9ea2733a922baea
I'm using reflection to commit it after I build:
```csharp
suggester.Build(enumerator);
var writer = suggester.GetType().GetField("writer", System.Reflection.BindingFlags.NonPublic
| System.Reflection.BindingFlags.Instance);
typeof(IndexWriter).GetMethod("Commit").Invoke(writer.GetValue(suggester), Array.Empty<object>());
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
|