<commit_before>using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using JoinRpg.Data.Write.Interfaces;
using JoinRpg.DataModel;
using JoinRpg.Services.Interfaces.Search;

namespace JoinRpg.Services.Impl.Search
{
  internal class UserSearchProvider : ISearchProvider
  {
    public IUnitOfWork UnitOfWork { private get; set; }

    public async Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString)
    {
      var results =
        await
          UnitOfWork.GetDbSet<User>()
            .Where(user =>
              //TODO There should be magic way to do this. Experiment with Expression.Voodoo
              user.Email.Contains(searchString)
              || user.FatherName.Contains(searchString)
              || user.BornName.Contains(searchString)
              || user.SurName.Contains(searchString)
            )
            .ToListAsync();

      return results.Select(user => new SearchResultImpl<commit_msg>Improve search<commit_after>using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using JoinRpg.Data.Write.Interfaces;
using JoinRpg.DataModel;
using JoinRpg.Services.Interfaces.Search;

namespace JoinRpg.Services.Impl.Search
{
  internal class UserSearchProvider : ISearchProvider
  {
    public IUnitOfWork UnitOfWork { private get; set; }

    public async Task<IReadOnlyCollection<ISearchResult>> SearchAsync(string searchString)
    {
      var results =
        await
          UnitOfWork.GetDbSet<User>()
            .Where(user =>
              //TODO There should be magic way to do this. Experiment with Expression.Voodoo
              user.Email.Contains(searchString)
              || user.FatherName.Contains(searchString)
              || user.BornName.Contains(searchString)
              || user.SurName.Contains(searchString)
              || user.PrefferedName.Contains(searchString)
              || (user.Extra != null && user.Extra.Nicknames != null && user.Extra.Nicknames.Contains(searchString))
            )
            .ToListAsync();

      return results.Select(user => new SearchResultImpl
{'fraction_non_alphanumeric': 0.0912863070539419, 'fraction_numerical': 0.0, 'mean_word_length': 2.847517730496454, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5319093', 'n_tokens_mistral': 586, 'n_tokens_neox': 579, 'n_words': 120}