[backend/core] Revert: "Fix negated search parameters when match:words is used"

This reverts commit 37fc124b08, as it caused search to not use the FTS index.
This commit is contained in:
Laura Hausmann 2025-01-10 07:31:26 +01:00
parent 37fc124b08
commit 77fef1e63e
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -274,34 +274,34 @@ public static class QueryableFtsExtensions
) => matchType.Equals(MatchFilterType.Substring)
? caseSensitivity.Equals(CaseFilterType.Sensitive)
? negated
? !EF.Functions.Like(note.Text ?? "", "%" + query + "%", @"\")
&& !EF.Functions.Like(note.Cw ?? "", "%" + query + "%", @"\")
&& !EF.Functions.Like(note.CombinedAltText ?? "", "%" + query + "%", @"\")
: EF.Functions.Like(note.Text ?? "", "%" + query + "%", @"\")
|| EF.Functions.Like(note.Cw ?? "", "%" + query + "%", @"\")
|| EF.Functions.Like(note.CombinedAltText ?? "", "%" + query + "%", @"\")
? !EF.Functions.Like(note.Text!, "%" + query + "%", @"\")
&& !EF.Functions.Like(note.Cw!, "%" + query + "%", @"\")
&& !EF.Functions.Like(note.CombinedAltText!, "%" + query + "%", @"\")
: EF.Functions.Like(note.Text!, "%" + query + "%", @"\")
|| EF.Functions.Like(note.Cw!, "%" + query + "%", @"\")
|| EF.Functions.Like(note.CombinedAltText!, "%" + query + "%", @"\")
: negated
? !EF.Functions.ILike(note.Text ?? "", "%" + query + "%", @"\")
&& !EF.Functions.ILike(note.Cw ?? "", "%" + query + "%", @"\")
&& !EF.Functions.ILike(note.CombinedAltText ?? "", "%" + query + "%", @"\")
: EF.Functions.ILike(note.Text ?? "", "%" + query + "%", @"\")
|| EF.Functions.ILike(note.Cw ?? "", "%" + query + "%", @"\")
|| EF.Functions.ILike(note.CombinedAltText ?? "", "%" + query + "%", @"\")
? !EF.Functions.ILike(note.Text!, "%" + query + "%", @"\")
&& !EF.Functions.ILike(note.Cw!, "%" + query + "%", @"\")
&& !EF.Functions.ILike(note.CombinedAltText!, "%" + query + "%", @"\")
: EF.Functions.ILike(note.Text!, "%" + query + "%", @"\")
|| EF.Functions.ILike(note.Cw!, "%" + query + "%", @"\")
|| EF.Functions.ILike(note.CombinedAltText!, "%" + query + "%", @"\")
: caseSensitivity.Equals(CaseFilterType.Sensitive)
? negated
? !Regex.IsMatch(note.Text ?? "", "\\y" + query + "\\y")
&& !Regex.IsMatch(note.Cw ?? "", "\\y" + query + "\\y")
&& !Regex.IsMatch(note.CombinedAltText ?? "", "\\y" + query + "\\y")
: Regex.IsMatch(note.Text ?? "", "\\y" + query + "\\y")
|| Regex.IsMatch(note.Cw ?? "", "\\y" + query + "\\y")
|| Regex.IsMatch(note.CombinedAltText ?? "", "\\y" + query + "\\y")
? !Regex.IsMatch(note.Text!, "\\y" + query + "\\y")
&& !Regex.IsMatch(note.Cw!, "\\y" + query + "\\y")
&& !Regex.IsMatch(note.CombinedAltText!, "\\y" + query + "\\y")
: Regex.IsMatch(note.Text!, "\\y" + query + "\\y")
|| Regex.IsMatch(note.Cw!, "\\y" + query + "\\y")
|| Regex.IsMatch(note.CombinedAltText!, "\\y" + query + "\\y")
: negated
? !Regex.IsMatch(note.Text ?? "", "\\y" + query + "\\y", RegexOptions.IgnoreCase)
&& !Regex.IsMatch(note.Cw ?? "", "\\y" + query + "\\y", RegexOptions.IgnoreCase)
&& !Regex.IsMatch(note.CombinedAltText ?? "", "\\y" + query + "\\y", RegexOptions.IgnoreCase)
: Regex.IsMatch(note.Text ?? "", "\\y" + query + "\\y", RegexOptions.IgnoreCase)
|| Regex.IsMatch(note.Cw ?? "", "\\y" + query + "\\y", RegexOptions.IgnoreCase)
|| Regex.IsMatch(note.CombinedAltText ?? "", "\\y" + query + "\\y", RegexOptions.IgnoreCase);
? !Regex.IsMatch(note.Text!, "\\y" + query + "\\y", RegexOptions.IgnoreCase)
&& !Regex.IsMatch(note.Cw!, "\\y" + query + "\\y", RegexOptions.IgnoreCase)
&& !Regex.IsMatch(note.CombinedAltText!, "\\y" + query + "\\y", RegexOptions.IgnoreCase)
: Regex.IsMatch(note.Text!, "\\y" + query + "\\y", RegexOptions.IgnoreCase)
|| Regex.IsMatch(note.Cw!, "\\y" + query + "\\y", RegexOptions.IgnoreCase)
|| Regex.IsMatch(note.CombinedAltText!, "\\y" + query + "\\y", RegexOptions.IgnoreCase);
[Projectable]
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global",