summaryrefslogtreecommitdiff
path: root/apt-private/private-search.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-09-02 18:20:49 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-09-07 19:27:10 +0200
commit25594bb5bddc031afc4d62f3164cd9116d778517 (patch)
tree835f4d6e3c3262a1268f038a2c6f87e36a544f9a /apt-private/private-search.cc
parent1a68655de92fd036ebc7c920bc2e5e88c54eb34e (diff)
make GetLocalitySortedVersionSet more generic
No reason in and of by itself at the moment, but prepares for the goal of having 'apt search' and 'apt-cache search' using the same code now that they at least support the same stuff. The 'apt' code is just a multitude slower at the moment… Git-Dch: Ignore
Diffstat (limited to 'apt-private/private-search.cc')
-rw-r--r--apt-private/private-search.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/apt-private/private-search.cc b/apt-private/private-search.cc
index 5e12902e8..6bce9ffa4 100644
--- a/apt-private/private-search.cc
+++ b/apt-private/private-search.cc
@@ -63,7 +63,7 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/
LocalitySortedVersionSet bag;
OpTextProgress progress(*_config);
progress.OverallProgress(0, 100, 50, _("Sorting"));
- GetLocalitySortedVersionSet(CacheFile, bag, progress);
+ GetLocalitySortedVersionSet(CacheFile, &bag, &progress);
LocalitySortedVersionSet::iterator V = bag.begin();
progress.OverallProgress(50, 100, 50, _("Full Text Search"));
@@ -77,6 +77,7 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/
format += " ${LongDescription}\n";
int Done = 0;
+ std::vector<bool> PkgsDone(Cache->Head().PackageCount, false);
for ( ;V != bag.end(); ++V)
{
if (Done%500 == 0)
@@ -84,10 +85,11 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/
++Done;
// we want to list each package only once
- char const * const PkgName = V.ParentPkg().Name();
- if (output_map.find(PkgName) != output_map.end())
+ pkgCache::PkgIterator const P = V.ParentPkg();
+ if (PkgsDone[P->ID] == true)
continue;
+ char const * const PkgName = P.Name();
pkgCache::DescIterator Desc = V.TranslatedDescription();
pkgRecords::Parser &parser = records.Lookup(Desc.FileList());
std::string const LongDesc = parser.LongDesc();
@@ -106,10 +108,11 @@ bool FullTextSearch(CommandLine &CmdL) /*{{{*/
}
if (all_found == true)
{
- std::stringstream outs;
- ListSingleVersion(CacheFile, records, V, outs, format);
- output_map.insert(std::make_pair<std::string, std::string>(
- PkgName, outs.str()));
+ PkgsDone[P->ID] = true;
+ std::stringstream outs;
+ ListSingleVersion(CacheFile, records, V, outs, format);
+ output_map.insert(std::make_pair<std::string, std::string>(
+ PkgName, outs.str()));
}
}
APT_FREE_PATTERNS();