1
1
# Add debtags tags to the index
3
import re, os, os.path, apt
5
5
DEBTAGSDB = "/var/lib/debtags/package-tags"
84
def index(self, document, pkg):
86
Update the document with the information from this data source.
88
document is the document to update
89
pkg is the python-apt Package object for this package
91
tagstring = pkg.candidateRecord['Tag']
84
def _parse_and_index(self, tagstring, document):
86
Parse tagstring into tags, and index the tags
92
88
def expandTags(mo):
94
90
ends = self.re_split.split(mo.group(2))
95
91
return ", ".join([root + x for x in ends])
96
tagstring = self.re_expand.sub(expandtags, tagstring)
92
tagstring = self.re_expand.sub(expandTags, tagstring)
97
93
for tag in self.re_split.split(tagstring):
98
94
document.add_term("XT"+tag)
97
def index(self, document, pkg):
99
Update the document with the information from this data source.
101
document is the document to update
102
pkg is the python-apt Package object for this package
104
rec = pkg.candidateRecord
105
if rec == None: return
107
self._parse_and_index(rec['Tag'], document)
111
def indexDeb822(self, document, pkg):
113
Update the document with the information from this data source.
115
This is alternative to index, and it is used when indexing with package
116
data taken from a custom Packages file.
118
document is the document to update
119
pkg is the Deb822 object for this package
122
self._parse_and_index(pkg['Tag'], document)