1 :
2 : /** @file
3 : * @author Enrico Zini <enrico@enricozini.org>
4 : * Fast full-text search
5 : */
6 :
7 : /*
8 : * Copyright (C) 2007 Enrico Zini <enrico@debian.org>
9 : *
10 : * This program is free software; you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License as published by
12 : * the Free Software Foundation; either version 2 of the License, or
13 : * (at your option) any later version.
14 : *
15 : * This program is distributed in the hope that it will be useful,
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : * GNU General Public License for more details.
19 : *
20 : * You should have received a copy of the GNU General Public License
21 : * along with this program; if not, write to the Free Software
22 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 : */
24 :
25 : #include <ept/textsearch/extraindexers.h>
26 : #include <ept/apt/packagerecord.h>
27 : #include <ept/debtags/debtags.h>
28 :
29 : using namespace std;
30 : using namespace ept::debtags;
31 :
32 : namespace ept {
33 : namespace textsearch {
34 :
35 0 : void AptTagsExtraIndexer::operator()(Xapian::Document& doc, const apt::PackageRecord& rec) const
36 : {
37 : // Index tags as well
38 0 : set<string> tags = rec.tag();
39 0 : for (set<string>::const_iterator ti = tags.begin();
40 : ti != tags.end(); ++ti)
41 0 : doc.add_term("XT"+*ti);
42 0 : }
43 :
44 0 : void DebtagsExtraIndexer::operator()(Xapian::Document& doc, const apt::PackageRecord& rec) const
45 : {
46 : // Index tags as well
47 0 : set<Tag> tags = debtags.getTagsOfItem(doc.get_data());
48 0 : for (set<Tag>::const_iterator ti = tags.begin();
49 : ti != tags.end(); ++ti)
50 0 : doc.add_term("XT"+ti->fullname());
51 0 : }
52 :
53 : }
54 : }
55 :
56 : #include <ept/debtags/debtags.tcc>
57 :
58 : // vim:set ts=4 sw=4:
|