Browse Source

fix search index validation (#782)

pull/783/head
Jason Dove 4 years ago committed by GitHub
parent
commit
fcfd579b37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 22
      ErsatzTV.Infrastructure/Search/SearchIndex.cs

1
CHANGELOG.md

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix processing local movie NFO metadata without a `year` value - Fix processing local movie NFO metadata without a `year` value
- Fix processing local movie fallback metadata - Fix processing local movie fallback metadata
- Fix search edge case where very recently added items (hours) would not be returned by relative date queries - Fix search edge case where very recently added items (hours) would not be returned by relative date queries
- Fix search index validation on startup; improper validation was causing a rebuild with every startup
### Added ### Added
- Add `show_genre` and `show_tag` to search index for seasons and episodes - Add `show_genre` and `show_tag` to search index for seasons and episodes

22
ErsatzTV.Infrastructure/Search/SearchIndex.cs

@ -245,13 +245,21 @@ public sealed class SearchIndex : ISearchIndex
{ {
try try
{ {
using var d = FSDirectory.Open(folder); using (var d = FSDirectory.Open(folder))
var analyzer = new StandardAnalyzer(AppLuceneVersion); {
var indexConfig = new IndexWriterConfig(AppLuceneVersion, analyzer) using (var analyzer = new StandardAnalyzer(AppLuceneVersion))
{ OpenMode = OpenMode.CREATE_OR_APPEND }; {
using var w = new IndexWriter(_directory, indexConfig); var indexConfig = new IndexWriterConfig(AppLuceneVersion, analyzer)
using DirectoryReader r = w.GetReader(true); { OpenMode = OpenMode.CREATE_OR_APPEND };
return true; using (var w = new IndexWriter(d, indexConfig))
{
using (DirectoryReader _ = w.GetReader(true))
{
return true;
}
}
}
}
} }
catch catch
{ {

Loading…
Cancel
Save