public async Task <SymbolSearchResult> SearchAsync(ICollection <string> repositories, string searchTerm, string classification, int maxNumberOfItems) { Classification?parsedClassification = ClassificationEx.TryParse(classification); ElasticResponse <List <DefinitionSearchSpanModel> > results; results = await Provider.SearchByTermInDefinition(repositories, searchTerm, parsedClassification, maxNumberOfItems); //if (searchTerm.Contains(".")) //{ //} //else //{ // results = await _provider.SearchByShortNameAsync(repositories, searchTerm, parsedClassification, maxNumberOfItems); //} List <SymbolSearchResultEntry> convertedEntries = ModelConverter.ToSymbolSearchResults(results.Result); var projectRanks = ProjectRanks; convertedEntries.ForEach(symbol => symbol.Rank = projectRanks.GetOrDefault(symbol.Symbol.ProjectId)); SearchResultSorter.Sort(convertedEntries, searchTerm); return(new SymbolSearchResult { Entries = convertedEntries, Total = results.Total, QueryText = searchTerm }); }
public async Task <List <SymbolSearchResultEntry> > GetRelatedDefinitions( ICollection <string> repos, string definitionId, string projectId) { ElasticResponse <List <DefinitionSearchSpanModel> > results; results = await Provider.GetRelatedDefinitions(repos, definitionId, projectId); List <SymbolSearchResultEntry> convertedEntries = ModelConverter.ToSymbolSearchResults(results.Result); return(convertedEntries); }