mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
use regex instead of indexof with search
This commit is contained in:
parent
33f4b2ed53
commit
8217bafb24
@ -1,4 +1,5 @@
|
||||
using Lucene.Net.Analysis.Standard;
|
||||
using System.Text.RegularExpressions;
|
||||
using Lucene.Net.Analysis.Standard;
|
||||
using Lucene.Net.Documents;
|
||||
using Lucene.Net.Index;
|
||||
using Lucene.Net.QueryParsers;
|
||||
@ -240,7 +241,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return new Tuple<string, int>(searchInput, 0);
|
||||
}
|
||||
|
||||
var index = input.IndexOf(searchInput, StringComparison.OrdinalIgnoreCase);
|
||||
var match = Regex.Match(input, searchInput, RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var index = match.Index;
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
@ -250,6 +255,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
{
|
||||
return new Tuple<string, int>(searchInput, 2);
|
||||
}
|
||||
}
|
||||
|
||||
var items = GetWords(input);
|
||||
|
||||
@ -266,7 +272,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return new Tuple<string, int>(searchTerm, 3 + (i + 1) * (j + 1));
|
||||
}
|
||||
|
||||
index = item.IndexOf(searchTerm, StringComparison.OrdinalIgnoreCase);
|
||||
match = Regex.Match(item, searchTerm, RegexOptions.IgnoreCase);
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var index = match.Index;
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
@ -278,6 +288,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Tuple<string, int>(null, -1);
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
_logger.ErrorException("Error converted extracted subtitle {0}", ex, outputPath);
|
||||
_logger.ErrorException("Error deleting converted subtitle {0}", ex, outputPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user