xapers(1) personal journal article indexing system


xapers command [args ...]


Xapers is a personal document indexing system, geared towards academic journal articles. It provides fast search of document text and bibliographic data (synced from online libraries) and simple document and bibtex retrieval.

Xapers takes as input document files (as PDF) and source identifiers. Documents are copied into a local document store (~/.xapers/docs by default) and text is extracted from the PDF and fully indexed into a Xapian database. Source identifiers are used to download document bibliographic data from online digital libraries (see SOURCES below), which are then parsed and indexed to prefixed terms in the database. The bibliographic data is also stored as bibtex in the document store for easy retrieval. Documents can be arbitrarily tagged.

A curses UI is provided for simple access to documents (see the view command below). Xapers is ultimately a document indexing library, though, so development of alternate user interfaces is encouraged.

Underlying Xapers is the wonderful Xapian database/search engine. See http://xapian.org/ for more information.


The following are the main xapers commands. See SEARCH TERMS below for details of the supported syntax for <search-terms>.

add [options] [<search-terms>]

Add a document, or update an existing document. Must specify at least one of --file or --source. If search terms are provided they must match exactly one document and the matching document is updated with the newly provided information. Available options:

Source identifier for document. See SOURCES below. This may also be a path to a file that contains a single bibtex entry.
Document file (as PDF) to add. Text of document will be extracted and indexed. A copy of the file will be placed in the Xapers document store. If provided without path, xapers will attempt to download file from source, assuming source supports file downloads.
Initial tags to apply to document. Multiple tags can be specified, comma separated.
Prompt user for source/file/tags, if not specified. When prompting for source information input files are automatically scanned for source IDs and found ids are displayed.
View resulting entry in curses UI when done. See the viewP command below for more info.

import [options] <bibtex>

Import an existing bibtex database. Each bibtex entry will be added as a new document. If bibtex key, or any sources found in bibtex, match an existing document, that document is instead updated (this makes the command effectively idempotent). Any "file" fields will be parsed for document files to add. Files can be specified as a single path, or in Mendeley/Jabref format. Available options:

Tags to apply to all imported documents. Multiple tags can be specified, comma separated.

tag +<tag>|-<tag> [...] [--] <search-terms>

Add/remove tags from documents. '--' can be used to separate tagging operations from search terms.

search [options] <search-terms>

Search for documents in the database. Document information is printed to stdout.


Specify document information to be output:

summary outputs a single-line summary of the documents (default).

bibtex outputs bibtex for all documents (if available).

tags outputs all tags associated with documents.

sources outputs all sources associated with documents.

keys outputs all bibtex citation keys associated with documents.

files outputs the full paths to all files associated with documents.

Default is summary.


Limit number of results returned to N.

bibtex <search-terms>

Short for "search --output=bibtex <search-terms>".

count <search-terms>

Return a simple count of search results.

view [<search-terms>]

show [<search-terms>]

View search results in curses search UI. Documents matching search are displayed with their bibliographic information and a short text summary. It allows for manipulating document tags and for retrieved for document files and source URLs for viewing (see xdg-open(1) for more info). Initial search terms can be provided, but further searches can be performed from within the UI. While in the UI type "?" for available commands.

NOTE: At the moment only the top 20 search results are displayed, due to synchronous loading restrictions. This obviously needs to be fixed.

export <directory> <search-terms>

Copy PDF files of resulting documents into <directory>, named with document titles when available.

delete <search-terms>

Delete documents from the database. All document files will purged from the document store.

Do not prompt to confirm deletion of documents.


Restore a database from existing xapers root.


These commands provide access to some of the source module methods. See SOURCES below.


List available sources.

source2url <sid> [<sid>...]

Parse a source identifier string and print the corresponding source URL.

source2bib <sid> [<sid>...]

Retrieve bibtex from source for a specified URL or source id, and write to stdout.

source2file <sid>

Retrieve file from source for a specified URL or source id, and write to stdout.

scandoc <file>

Scan a document file (PDF) for source IDs, and print and recognized source ids to stdout.


Sources are online databases from which document bibliographic data can be retrieved. In Xapers, online libraries are assigned unique prefixes. The online libraries associate unique document identifiers to individual documents. See 'xapers sources' for a list of available online sources.

Xapers recognizes document a source identifier, or sid, in two forms:

  full URL                      http://dx.doi.org/10.1364/JOSAA.29.002092
  sid of form <source>:<id>     doi:10.1364/JOSAA.29.002092

URLs are parsed into sources and source ids when recognized, and this information is used to retrieve bibtex from the online library databases. The sources and sids for a given document are stored as prefixed terms in the Xapers database (see below).


Xapers supports a common syntax for search terms.

Search can consist of free-form text and quoted phrases. Terms can be combined with standard Boolean operators. All terms are combined with a logical OR by default. Parentheses can be used to group operators, but must be protect from shell interpretation. The string '*' will match all documents in the database.

Additionally, the following prefixed terms are understood (where <brackets> indicate user-supplied values):

    id:<docid>                   Xapers document ID
    author:<string>              string in authors (also a:)
    title:<string>               string in title (also t:)
    tag:<tag>                    specific user tag
    <source>:<id>                specific source id (sid)
    source:<source>              specific source
    key:<key>                    specific bibtex citation key
    year:<year>                  specific publication year (also y:)
    year:<since>..<until>        publication year range (also y:)

Publication years must be four-digit integers.

See the following for more information on search terms:



The following environment variables can be used to control the behavior of xapers:


Location of the Xapers document store. Defaults to "~/.xapers/docs" if not specified.


Path specification for location of additional custom Xapers source modules. Defaults to "~/.xapers/sources" if not specified.


Feel free to email the author:

    Jameson Rollins <[email protected]>