<commit_before>﻿namespace Bazooka.Core
{
    using NuGet;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    ///     Helpers to search packages list
    /// </summary>
    public static class PackageSearcher
    {
        /// <summary>
        ///     Searches all available versions of a package in a list of repostiories
        /// </summary>
        /// <param name="repositories">Repositories to search</param>
        /// <param name="packageName">Pacakge identifier</param>
        /// <returns>List of available versions</returns>
        public static ICollection<string> Search(ICollection<string> repositories, string packageName)
        {
            var factory = new PackageRepositoryFactory();
            var globalRepo = new AggregateRepository(factory, repositories, true);
            var packages = globalRepo.FindPackagesById(packageName);
            return packages.Select(x => x.Version)
                           .OrderBy(x => x)
                           .Select(x => x.ToString())
                           .ToList();
        }
    }
}<commit_msg>Corrected package searcher to ignore unlisted packages<commit_after>﻿namespace Bazooka.Core
{
    using NuGet;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    ///     Helpers to search packages list
    /// </summary>
    public static class PackageSearcher
    {
        /// <summary>
        ///     Searches all available versions of a package in a list of repostiories
        /// </summary>
        /// <param name="repositories">Repositories to search</param>
        /// <param name="packageName">Pacakge identifier</param>
        /// <returns>List of available versions</returns>
        public static ICollection<string> Search(ICollection<string> repositories, string packageName)
        {
            var factory = new PackageRepositoryFactory();
            var globalRepo = new AggregateRepository(factory, repositories, true);
            var packages = globalRepo.FindPackagesById(packageName);
            return packages.Where(x => x.Listed)
                           .Select(x => x.Version)
                           .OrderByDescending(x => x)
                           .Select(x => x.ToString())
                           .ToList();
        }
    }
}
{'fraction_non_alphanumeric': 0.10594315245478036, 'fraction_numerical': 0.0, 'mean_word_length': 1.9001248439450686, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 34, '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': '3806222', 'n_tokens_mistral': 588, 'n_tokens_neox': 582, 'n_words': 152}