From 8f373c3973d8b815c4e2569c57019e6dd3cbd848 Mon Sep 17 00:00:00 2001 From: seaz96 Date: Sun, 8 Dec 2024 15:08:50 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=81=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B1=D0=B0=D0=B3=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D1=8E=D1=82=20null=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BA=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API/Services/Search.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/API/Services/Search.cs b/API/Services/Search.cs index 6303fe2..0c9b6b1 100644 --- a/API/Services/Search.cs +++ b/API/Services/Search.cs @@ -2,14 +2,21 @@ using API.Models; using Core.Analyzer; using Microsoft.EntityFrameworkCore; +using Microsoft.OpenApi.Services; namespace API.Services; public class Search(DataContext context) : ISearch { //todo(azanov.n): мне кажется с такими запросами я превращаюсь в trainee + //todo(azanov.n): нужно научиться обрабатывать поиск с фильтрами и null text public async Task> SearchAsync(SearchQuery query) { + if (query.Text is null) + { + return await SearchAllAsync(query).ConfigureAwait(false); + } + var words = query.Text.TokenizeText().Filter().Stem().ToArray(); var dbWords = context.Words.Where(w => words.Contains(w.Content)).Select(w => w.Id);