apt-xapian-index - Everything you always wanted to index about Debian packages, but were afraid to ask
apt-xapian-index is a maintenance tools for a Xapian index of Debian package information This package provides update-apt-xapian-index, a tool to maintan a Xapian index of Debian package information in /var/lib/apt-xapian-index.
update-apt-xapian-index allows plugins to be installed in /usr/share/apt-xapian-index to index all sorts of extra information, such as Debtags tags, popcon information, package ratings and anything else that would fit.
The index generated by update-apt-xapian-index is self-documenting, as it contains an autogenerated README file with information on the index layout and all the data that can be found in it.
Resources:
News
fuss-launcher: an application launcher built on apt-xapian-index
Long ago I blogged about using apt-xapian-index to write an application launcher.
Now I just added a couple of new apt-xapian-index plugins that look like they have been made just for that.
In fact, they have indeed been made just for that.
After my blog post in 2008, people from Truelite and the FUSS project took up the challenge and wrote a launcher applet around my example engine.
The prototype has been quite successful in FUSS, and as a consequence I've been asked (and paid) to bring in some improvements.
The result, that I have just uploaded to NEW, is a package called
fuss-launcher:
* New upstream release
- Use newer apt-xapian-index: removed need of local index
- Dragging a file in the launcher shows the applications that can open it
- Remembers the applications launched more frequently
- Allow to set a list of favourite applications
To get it:
apt-get install fuss-launcher(after it passed NEW);- or
git clone http://git.fuss.bz.it/git/launcher.git/andapt-get install python-gtk2 python-xapian python-xdg apt-xapian-index app-install-data
It requires apt-xapian-index >= 0.35.
To try it:
- Make sure your index is up to date, especially if you just installed
app-install-data: just runupdate-apt-xapian-indexas root. - Run
fuss-launcher. - Click on the new tray icon to open the launcher dialog.
- Type some keywords and see the list of matching applications come to life as you type.
It's worth mentioning again that all this work was sponsored by Truelite and the Fuss project, which rocks.
Some screenshots:
When you open the launcher, by default it shows the most frequently started applicationss and the favourite applications:
When you type some keywords, you get results as you type, and context-sensitive completion:
When you drag a file on the launcher you only see the applications that can open that file:
New apt-xapian-index plugins
Besides a fair bit of refactoring and cleanup, I've recently added two new plugins to apt-xapian-index:
app-install
If app-install-data is installed, information about .desktop files will now enter the index.
This allows, for example, to limit query results to only those packages that contain .desktop files, which is quite useful, for example for building desktop-oriented package managers.
aliases
It reads term->aliases mapping from files in /etc/apt-xapian-index/aliases/
or /usr/share/apt-xapian-index/aliases/, and feeds them as
synonyms in the index.
apt-xapian-index ships an example alias file, to give people who know the wrong software names a chance to find the right ones:
# Aliases expanding names of popular applications
excel XToffice::spreadsheet
powerpoint XToffice::presentation
photoshop XTworks-with::image:raster
coreldraw XTworks-with::image:vector
autocad XTworks-with::3dmodel
Notice how it is possible to use index terms that happen to be Debtags tags as synonyms, which yields better results, language independence and extra coolness.
apt-xapian-index now comes with a query tool
I've just uploaded a new version of apt-xapian-index to unstable. Now it comes with a little query tool called axi-cache.
You can search this way:
axi-cache search foo bar baz facet::tag sec:section
In fact, you can use most of the things described here.
You can then say axi-cache more to get more results, or axi-cache again to
retry a search, or axi-cache again wibble wabble to add keywords to the
last search.
This allows to start with a search and tweak it. In order to work it needs to
save the last search so again or more can amend it. Searches are saved in
~/.cache/axi-cache.state.
You can search tags instead of packages by adding --tags.
It will suggest extra terms for the search, and also suggest extra tags.
It can even correct spelling mistakes in the query terms once the index has
been rebuilt with this new version of update-apt-xapian-index.
I need to thank Carl Worth who, with notmuch, reminded me that if I just build a nice interface on top of Xapian's query parser I go quite a long way towards making a Xapian database extremely useful indeed.
axi-cache also integrates with bash-completion so that tab completion is
context-sensitive to the command line being typed:
$ axi-cache search image pro
probability process processors programmability provides
problem processing production pronounced proving
$ axi-cache search kernel pro
problems processor production proved provided
processing processors programming provide provides
Thanks to David Paleino who wrote the bash completion script.
Just for reference, this is the command line help:
$ axi-cache help
Usage: axi-cache [options] command [args]
Query the Apt Xapian index.
Commands:
axi-cache help show a summary of commands
axi-cache search [terms] start a new search
axi-cache again [query] repeat the last search, possibly adding query terms
axi-cache more [count] show more terms from the last search
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-s SORT, --sort=SORT sort by the given value, as listed in /var/lib/apt-
xapian-index/values
--tags show matching tags, rather than packages
--tabcomplete=TYPE suggest words for tab completion of the current
command line (type is 'plain' or 'partial')
If you install the package for the first time, you may need to rebuild the
index by running update-apt-xapian-index as root before using axi-cache.


