Chapter 5. Searching on the command line

There are several ways to obtain search results as a text stream, without a graphical interface:

The first two methods work in the same way and accept/need the same arguments (except for the additional -t to recoll). The query to be executed is specified as command line arguments.

recollq is not built by default. You can use the Makefile in the query directory to build it. This is a very simple program, and it will often be useful to taylor its output format to your needs.

recollq has a man page (not installed by default, look in the doc/man directory). The Usage string is as follows:

recollq [-o|-a|-f] <query string>
 Runs a recoll query and displays result lines. 
  Default: will interpret the argument(s) as a query language string
  -o Emulate the gui simple search in ANY TERM mode
  -a Emulate the gui simple search in ALL TERMS mode
  -f Emulate the gui simple search in filename mode
Common options:
    -c <configdir> : specify config directory, overriding $RECOLL_CONFDIR
    -d also dump file contents
    -n <cnt> limit the maximum number of results (0->no limit, default 2000)
    -b : basic. Just output urls, no mime types or titles
    -m : dump the whole document meta[] array
    -S fld : sort by field name
    -D : sort descending

Sample execution:

recollq 'ilur -nautique mime:text/html'
Recoll query: ((((ilur:(wqf=11) OR ilurs) AND_NOT (nautique:(wqf=11)
  OR nautiques OR nautiqu OR nautiquement)) FILTER Ttext/html))
4 results
text/html       [file:///Users/uncrypted-dockes/projets/bateaux/ilur/comptes.html]      [comptes.html]  18593   bytes   
text/html       [file:///Users/uncrypted-dockes/projets/nautique/webnautique/articles/ilur1/index.html] [Constructio...
text/html       [file:///Users/uncrypted-dockes/projets/pagepers/index.html]    [psxtcl/writemime/recoll]...
text/html       [file:///Users/uncrypted-dockes/projets/bateaux/ilur/factEtCie/recu-chasse-maree....