~gary-lasker/software-center/replace-restfulclient-with-piston-tweaks

« back to all changes in this revision

Viewing changes to softwarecenter/db/enquire.py

  • Committer: Gary Lasker
  • Date: 2012-01-04 23:25:37 UTC
  • mfrom: (2617.2.10 startup-speed2)
  • Revision ID: gary.lasker@canonical.com-20120104232537-053uxnx9a2tmzqty
merged lp:~mvo/software-center/startup-speed2, super-speedy mvo

Show diffs side-by-side

added added

removed removed

Lines of Context:
239
239
        self._perform_search_complete = True
240
240
        return
241
241
 
 
242
    def get_estimated_matches_count(self, query):
 
243
        with ExecutionTime("estimate item count for query: '%s'" % query):
 
244
            enquire = xapian.Enquire(self.db.xapiandb)
 
245
            enquire.set_query(query)
 
246
            # no performance difference between the two
 
247
            #tmp_matches = enquire.get_mset(0, 1, None, None)
 
248
            #nr_pkgs = tmp_matches.get_matches_estimated()
 
249
            tmp_matches = enquire.get_mset(0, len(self.db), None, None)
 
250
            nr_pkgs = len(tmp_matches)
 
251
        return nr_pkgs
 
252
 
242
253
    def set_query(self, search_query, 
243
254
                  limit=DEFAULT_SEARCH_LIMIT,
244
255
                  sortmode=SortMethods.UNSORTED, 
298
309
        # if list we append them one by one
299
310
        with ExecutionTime("populate model from query: '%s' (threaded: %s)" % (
300
311
                " ; ".join([str(q) for q in self.search_query]),
301
 
                self.nonblocking_load)):
 
312
                self.nonblocking_load), with_traceback=True):
302
313
            if self.nonblocking_load:
303
314
                self._threaded_perform_search()
304
315
            else: