public async Task Execute(ISearchTerm commandDto, Action <List <ICollectionEntity> > successHandler, Action <Exception> errorHandler) { var result = await _searchEngine.GetSongs(commandDto.Term); var mappedResult = result.Map(tracks => { var collectionsList = new List <ICollectionEntity>(); var collections = tracks.OrderBy(t => t).GroupBy(t => t.CollectionName); foreach (var collection in collections) { var collectionEntity = new CollectionEntity() { Name = collection.Key }; foreach (var track in collection) { collectionEntity.Tracks.Add(track); } collectionsList.Add(collectionEntity); } return(collectionsList); }); mappedResult.Match(successHandler, errorHandler); }
protected ScanHit(SerializationInfo info, StreamingContext context) { _filePath = info.GetString(FilePathKey); _line = info.GetInt32(LineKey); _column = info.GetInt32(ColumnKey); _term = (ISearchTerm)info.GetValue(TermKey, typeof(ISearchTerm)); _lineText = info.GetString(LineTextKey); _warning = info.GetString(WarningKey); }
public ScanHit(string filePath, int line, int column, string lineText, ISearchTerm term, string warning) { _filePath = filePath; _line = line; _column = column; _term = term; _lineText = lineText; _warning = warning; }
public static void Add(this IQueryBuilder builder, ISearchTerm term, TermOccur occur) { switch (occur) { case TermOccur.Must: builder.Must(term); break; case TermOccur.MustNot: builder.MustNot(term); break; default: throw new NotSupportedException($"Occur {occur} is not supported"); } }
public MatchableTerm(ISearchTerm term, int originalTableIndex, int originalTermIndex) { _term = term; _originalTableIndex = originalTableIndex; _originalTermIndex = originalTermIndex; }
protected Exclusion(SerializationInfo info, StreamingContext context) { _text = info.GetString(TextKey); _term = (ISearchTerm)info.GetValue(TermKey, typeof(ISearchTerm)); }
public Exclusion(string text, ISearchTerm term) { _text = text; _term = term; }
public void AddSearchTerm(ISearchTerm term) { _termList.Add(term); }
public IQueryBuilder MustNot(ISearchTerm term) { _query.Append($" {LuceneHelper.MUST_NOT_OPERATOR}{term.ToLuceneString()}"); return(this); }
protected string GetRegexEscapedTermValue(ISearchTerm term) { return(term.Value.Replace("'", "\\'")); }