~ubuntu-branches/ubuntu/oneiric/apt-xapian-index/oneiric

« back to all changes in this revision

Viewing changes to axi-cache

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Enrico Zini, Colin Watson
  • Date: 2010-09-10 13:10:42 UTC
  • Revision ID: james.westby@ubuntu.com-20100910131042-0c9upj2ir95aly8x
Tags: 0.39
[ Enrico Zini ]
* Fixed tests on Ubuntu (Thanks Michael Vogt for the patch)
* Added cataloged-times plugin by Michael Vogt
* Handle multiple invocations of indexer via dbus
* Described axi-cache in the package description

[ Colin Watson ]
* Fix more crashes when the Dir::Cache::pkgcache file doesn't exist, along
  the same lines as Martin Pitt's change in 0.38 (LP: #267330).
* Use the new MSetItem attribute API, introduced in Xapian 1.0.0, rather
  than the sequence API which was removed in 1.1.0 (closes: #595916).
* Create the XDG cache directory with appropriate permissions if it
  doesn't exist.
* Set better NAME sections in manual pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import os, os.path
32
32
import axi
33
33
 
34
 
VERSION="0.38"
 
34
VERSION="0.39"
35
35
 
36
36
# Setup configuration
37
37
DEBTAGS_VOCABULARY = "/var/lib/debtags/vocabulary"
150
150
        def save(self):
151
151
            "Save the state so we find it next time"
152
152
            if self.dirty:
 
153
                if not os.path.exists(XDG_CACHE_HOME):
 
154
                    os.makedirs(XDG_CACHE_HOME, mode=0700)
153
155
                self.cache.write(open(CACHEFILE, "w"))
154
156
                self.dirty = False
155
157
 
271
273
            # terms
272
274
            rset = xapian.RSet()
273
275
            for m in self.enquire.get_mset(0, 30):
274
 
                rset.add_document(m[xapian.MSET_DID])
 
276
                rset.add_document(m.docid)
275
277
 
276
278
            # Get results, optionally filtered
277
279
            if filter is None:
470
472
                self.db.build_query()
471
473
                first = int(self.db.get_cache_last("lastfirst", 0))
472
474
                for m in self.db.get_matches(first = first):
473
 
                    pkg = m[xapian.MSET_DOCUMENT].get_data()
 
475
                    pkg = m.document.get_data()
474
476
                    if partial is not None and not pkg.startswith(partial): continue
475
477
                    if pkg not in blacklist:
476
478
                        print pkg
589
591
            print "Results %i-%i:" % (first + 1, first + count)
590
592
            aptcache = apt.Cache(progress=AptSilentProgress())
591
593
            for m in matches:
592
 
                name = m[xapian.MSET_DOCUMENT].get_data()
 
594
                name = m.document.get_data()
593
595
                try:
594
596
                    pkg = aptcache[name]
595
597
                except KeyError:
596
598
                    pkg = None
597
599
                if pkg is not None and pkg.candidate:
598
 
                    print "%i%% %s - %s" % (m[xapian.MSET_PERCENT], name, pkg.candidate.summary)
 
600
                    print "%i%% %s - %s" % (m.percent, name, pkg.candidate.summary)
599
601
                else:
600
 
                    print "%i%% %s - (unknown by apt)" % (m[xapian.MSET_PERCENT], name)
 
602
                    print "%i%% %s - (unknown by apt)" % (m.percent, name)
601
603
            if first == 0:
602
604
                sc = self.db.get_spelling_correction()
603
605
                if sc: