Enrico Zini: axi-query-similar
apt-xapian-index: searching for similar packages
I've recently posted:
Then we build the big term list, by iterating the termlist of the document:
Note that it's trivial to fetch terms from more than one document, if you want
to query "all packages a bit like this one and a bit like that one", although
that's less of a useful feature.
Lastly, we build the final query:
I add an AND_NOT part with the input package name so that we don't get in the
output the package that we asked for.
This is it:
- an introduction of apt-xapian-index;
- an example of how to query it;
- a way to add simple result filters to the query;
- a way to suggest keywords and tags to use to improve the query.
- Get the Xapian document for the package.
- Get the termlist of the document.
def docForPackage(pkgname): "Get the document corresponding to the package with the given name" # Query the term with the package name query = xapian.Query("XP"+pkgname) enquire = xapian.Enquire(db) enquire.set_query(query) # Get the top result only matches = enquire.get_mset(0, 1) if matches.size() == 0: return None else: m = matches[0] return m[xapian.MSET_DOCUMENT]
# Build a term list with all the terms in the given packages terms = [] # Get the document corresponding to the package name doc = docForPackage(pkgname) if not doc: continue # Retrieve all the terms in the document for t in doc.termlist(): if len(t.term) < 2 or t.term[:2] != 'XP': terms.append(t.term)
# Build the big OR query query = xapian.Query(xapian.Query.OP_AND_NOT, # Terms we want xapian.Query(xapian.Query.OP_OR, terms), # AND NOT the input packages xapian.Query("XP"+pkgname))
$ ./axi-query-similar.py debtags
20309 results found.
Results 1-20:
33% debtags-edit - GUI browser and editor for Debian Package Tags
27% tagcolledit - GUI editor for tagged collections
25% libtagcoll2-dev - Functions used to manipulate tagged collections (development version)
24% tagcoll - Commandline tool to perform operations on tagged collections
19% packagesearch - GUI for searching packages and viewing package information
18% doodle - Desktop Search Engine (client)
18% doodled - Desktop Search Engine (daemon)
18% libept0 - High-level library for managing Debian package information
18% upgrade-system - system upgrader from Konflux
18% libept-dev - High-level library for managing Debian package information
17% ept-cache - Commandline tool to search the package archive
16% tracker-utils - metadata database, indexer and search tool - commandline tools
[...]
You can use the wsvn interface to get to the full source code and the module it uses.
Next in the series: adaptive quality cutoff.
Linux-hero 
If, like me, you’ve been following development of Joey’s nifty new
After years of on-again-off-again infatuation I now own my very own steam engine.
This makes me far far happier than I was expecting.
In other news a new release of xen-tools was made to fix some stupid bugs, a release of xen-shell is pending for the same reason, and after declaring I'd not make another release of
Well I somehow expected it will happen to me when I started to use
Debian experimental distribution, but now it really happened. I noticed that
last Gammu upload went to unstable instead of experimental just when today
updating my other development machine and I was surprised that Gammu is going
to be updated. Well the version is not that bad, but it is far from being
stable.
Anyway it is good for something - unstable users will do much more testing
than experimental ones ;-).
I attended my first half-yearly meeting as
a member of
I found it easily,
which gave me a few minutes spare to visit
the co-operative food store on the Centre
(pictured),
which is the first rebranded one I've seen.
It looks light and airy and
the staff were friendly. I didn't find
everything I was looking for, but after
exiting, I noticed I'd not seen around the
corner of the L-shaped store!
Anyway, the meeting itself was chaired by
Peter Begley and was attended by six elected
reps, three regional officers, four trading
managers (all food?) and about 50 members
by my reckoning. There was a comment later
in the meeting about the low turnout from
Bath - it seems that a meeting for each city
had been requested and refused.
There was also a comment about lack of
transport from Weston-super-Mare, about
which I'm not sure: trains between WsM
and Bristol are at least hourly. Maybe
there should be a shuttle between station
and meeting for people who can't walk,
but it seems nuts to run a bus from here
when trains are faster and have space.
Officer
Chris Griffiths gave a presentation (with
loud music!) about our community support,
including windfarms on the co-operative farms,
Farm to Fork, the Woodcraft Folk,
the Queens Award for Sustainable Development,
community chef visits to Ilfracombe and Bath,
community challenge,
Mukti Mitchell's Low Carbon Lifestyle Tour,
Fairtrade fashion shows,
Holyland Handicrafts Co-operative at Bath
Christmas Market,
BAND (D is for Daycare, but I missed the rest),
Toy Box Library Bath,
Avonmouth Community Centre Association
and Oldfield Park Juniors.
Frank Jones presented
Last week I helped