Skip to content

Commit

Permalink
(chocolateyGH-1831) search/list/info - use package search optimizations
Browse files Browse the repository at this point in the history
When searching for packages based on id, instead of using the older
methods, use the optimizations if they are turned on in the
configuration. This follows chocolateyGH-1397 to ensure that info uses the same
algorithm.
  • Loading branch information
ferventcoder committed May 26, 2019
1 parent 754cd0a commit 97a171f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/chocolatey/infrastructure.app/nuget/NugetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ private static IQueryable<IPackage> execute_package_search(ChocolateyConfigurati

IQueryable<IPackage> results = packageRepository.Search(searchTermLower, configuration.Prerelease);

SemanticVersion version = !string.IsNullOrWhiteSpace(configuration.Version) ? new SemanticVersion(configuration.Version) : null;

if (configuration.ListCommand.Exact)
{
results = packageRepository.FindPackagesById(searchTermLower).AsQueryable();
return new List<IPackage>()
{
find_package(searchTermLower, version, configuration, packageRepository)
}.AsQueryable();
}

if (configuration.ListCommand.Page.HasValue)
Expand Down

0 comments on commit 97a171f

Please sign in to comment.