diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 4c17b67..e113802 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -146,6 +146,7 @@ class RPMDBPackageSack(PackageSackBase):
         self._tup2pkg = {}
         self._completely_loaded = False
         self._pkgmatch_fails = set()
+        self._provmatch_fails = set()
         self._simple_pkgtup_list = []
         self._get_pro_cache = {}
         self._get_req_cache  = {}
@@ -193,6 +194,7 @@ class RPMDBPackageSack(PackageSackBase):
         self._tup2pkg = {}
         self._completely_loaded = False
         self._pkgmatch_fails = set()
+        self._provmatch_fails = set()
         self._simple_pkgtup_list = []
         self._get_pro_cache = {}
         self._get_req_cache = {}
@@ -323,11 +325,11 @@ class RPMDBPackageSack(PackageSackBase):
         return result
 
     def searchProvides(self, name):
-        if name in self._pkgmatch_fails:
+        if name in self._provmatch_fails:
             return []
         ret = self.searchPrco(name, 'provides')
         if not ret:
-            self._pkgmatch_fails.add(name)
+            self._provmatch_fails.add(name)
         return ret
 
     def searchRequires(self, name):
@@ -986,6 +988,9 @@ class RPMDBPackageSack(PackageSackBase):
 
     def _search(self, name=None, epoch=None, ver=None, rel=None, arch=None):
         '''List of matching packages, to zero or more of NEVRA.'''
+        if name is not None and name in self._pkgmatch_fails:
+            return []
+
         pkgtup = (name, arch, epoch, ver, rel)
         if pkgtup in self._tup2pkg:
             return [self._tup2pkg[pkgtup]]
@@ -996,6 +1001,8 @@ class RPMDBPackageSack(PackageSackBase):
         if self._completely_loaded or name in self._pkgnames_loaded:
             if name is not None:
                 pkgs = self._name2pkg.get(name, [])
+                if not pkgs:
+                    self._pkgmatch_fails.add(name)
             else:
                 pkgs = self.returnPkgs()
             for po in pkgs:
@@ -1009,19 +1016,22 @@ class RPMDBPackageSack(PackageSackBase):
         ts = self.readOnlyTS()
         if name is not None:
             mi = ts.dbMatch('name', name)
-            #  We create POs out of all matching names, even if we don't return
-            # them.
-            self._pkgnames_loaded.add(name)
         elif arch is not None:
             mi = ts.dbMatch('arch', arch)
         else:
             mi = ts.dbMatch()
             self._completely_loaded = True
 
+        done = False
         for hdr in mi:
             if hdr['name'] == 'gpg-pubkey':
                 continue
             po = self._makePackageObject(hdr, mi.instance())
+            #  We create POs out of all matching names, even if we don't return
+            # them.
+            self._pkgnames_loaded.add(po.name)
+            done = True
+
             for tag in ('arch', 'rel', 'ver', 'epoch'):
                 if loc[tag] is not None and loc[tag] != getattr(po, tag):
                     break
@@ -1031,6 +1041,9 @@ class RPMDBPackageSack(PackageSackBase):
         if self.auto_close:
             self.ts.close()
 
+        if not done and name is not None:
+            self._pkgmatch_fails.add(name)
+
         return ret
 
     def _makePackageObject(self, hdr, index):
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 8a4ec8b..344a966 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -429,6 +429,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         self._pkgtup2pkgs = {}
         self._pkgnames_loaded = set()
         self._pkgmatch_fails = set()
+        self._provmatch_fails = set()
         self._arch_allowed = None
         self._pkgExcluder = []
         self._pkgExcludeIds = {}
@@ -493,6 +494,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
         self._pkgname2pkgkeys = {}
         self._pkgnames_loaded = set()
         self._pkgmatch_fails = set()
+        self._provmatch_fails = set()
         self._pkgtup2pkgs = {}
         self._search_cache = {
             'provides' : { },
@@ -1374,11 +1376,11 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack):
 
     def searchProvides(self, name):
         """return list of packages providing name (any evr and flag)"""
-        if name in self._pkgmatch_fails:
+        if name in self._provmatch_fails:
             return []
         ret = self.searchPrco(name, "provides")
         if not ret:
-            self._pkgmatch_fails.add(name)
+            self._provmatch_fails.add(name)
         return ret
                 
     def searchRequires(self, name):
