~ubuntu-branches/ubuntu/lucid/software-center/lucid

« back to all changes in this revision

Viewing changes to softwarecenter/db/update.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Michael Vogt, Gary Lasker
  • Date: 2010-02-17 10:13:41 UTC
  • Revision ID: james.westby@ubuntu.com-20100217101341-x134t7lm0bss3jxn
Tags: 1.1.12
[ Michael Vogt ]
* merged lp:~mmcg069/software-center/spinner  (many thanks)
* merged lp:~mmcg069/software-center/fixes-and-tweaks  (many thanks)

[ Gary Lasker ]
* implement standalone presentation of individual software
  repositories

[ Michael Vogt ]
* README:
  - document menu.d/ directory
* softwarecenter/view/catview.py:
  - add SCPkgname xml filter
* apt-xapian-index-plugin/software-center.py:
  - add custom apt-xapian-index plugins for indexing 
    "XB-Softwarecenter-Appname" in debian/control
* apt-xapian-index-plugin/origin.py:
  - add custom apt-xapian-index plugins for indexing the origins
* softwarecenter/distro/Ubuntu.py:
  - add abstraction for distro_channel_{name,description}
* softwarecenter/distro/__init__.py:
  - make get_distro() return a singleton
* softwarecenter/view/channelpane.py:
  - for the main distro channel, show only apps, not all packages
* data/featured.menu.in:
  - add a "Featured" category

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
            pass
84
84
        return categories
85
85
 
 
86
def index_name(doc, name, term_generator):
 
87
    """ index the name of the application """
 
88
    doc.add_value(XAPIAN_VALUE_APPNAME, name)
 
89
    doc.add_term("AA"+name)
 
90
    w = globals()["WEIGHT_DESKTOP_NAME"]
 
91
    term_generator.index_text_without_positions(name, w)
 
92
 
86
93
def update(db, cache, datadir=APP_INSTALL_PATH):
87
94
    " index the desktop files in $datadir/desktop/*.desktop "
88
95
    term_generator = xapian.TermGenerator()
105
112
                logging.debug("duplicated name '%s' (%s)" % (name, desktopf))
106
113
            seen.add(name)
107
114
            doc.set_data(name)
108
 
            doc.add_value(XAPIAN_VALUE_APPNAME, name)
109
 
            doc.add_term("AA"+name)
 
115
            index_name(doc, name, term_generator)
110
116
            # check if we should ignore this file
111
117
            if parser.has_option_desktop("X-AppInstall-Ignore"):
112
118
                ignore = parser.get_desktop("X-AppInstall-Ignore")
161
167
                doc.add_value(XAPIAN_VALUE_POPCON, 
162
168
                              xapian.sortable_serialise(popcon))
163
169
                popcon_max = max(popcon_max, popcon)
 
170
 
164
171
            # comment goes into the summary data if there is one,
165
 
            # other wise we try GenericName
 
172
            # other wise we try GenericName and if nothing else,
 
173
            # the summary of the package
166
174
            if parser.has_option_desktop("Comment"):
167
175
                s = parser.get_desktop("Comment")
168
176
                doc.add_value(XAPIAN_VALUE_SUMMARY, s)
178
186
            term_generator.index_text_without_positions(pkgname, WEIGHT_APT_PKGNAME)
179
187
 
180
188
            # now add search data from the desktop file
181
 
            for key in ["Name","Generic Name","Comment"]:
 
189
            for key in ["GenericName","Comment"]:
182
190
                if not parser.has_option_desktop(key):
183
191
                    continue
184
192
                s = parser.get_desktop(key)
185
193
                w = globals()["WEIGHT_DESKTOP_"+key.replace(" ","").upper()]
186
 
                term_generator.index_text_without_positions(s)
 
194
                term_generator.index_text_without_positions(s, w)
187
195
            # add data from the apt cache
188
196
            if pkgname in cache and cache[pkgname].candidate:
189
197
                s = cache[pkgname].candidate.summary
190
198
                term_generator.index_text_without_positions(s, WEIGHT_APT_SUMMARY)
191
199
                s = cache[pkgname].candidate.description
192
200
                term_generator.index_text_without_positions(s, WEIGHT_APT_DESCRIPTION)
 
201
                for origin in cache[pkgname].candidate.origins:
 
202
                    doc.add_term("XOA"+origin.archive)
 
203
                    doc.add_term("XOC"+origin.component)
 
204
                    doc.add_term("XOL"+origin.label)
 
205
                    doc.add_term("XOO"+origin.origin)
 
206
                    doc.add_term("XOS"+origin.site)
 
207
 
193
208
            # add our keywords (with high priority)
194
209
            if parser.has_option_desktop("X-AppInstall-Keywords"):
195
210
                keywords = parser.get_desktop("X-AppInstall-Keywords")