[recoll-user] Re: Tweaking the recollq CLI

  • From: jfd@xxxxxxxxxx
  • To: recoll-user@xxxxxxxxxxxxx
  • Date: Mon, 12 Sep 2011 08:54:21 +0200

Roger Lainson writes:
 > Hi,

Hi Roger, 

It appears that my answer to your email of Sep 1st did not make it
through for some reason. I'll resend it, but I also paste the contents
below as some parts may be of interest to other people.

 > My little company has 7 users and we want to search a shared collection 
 > of documents and message files on a server. Recoll, built without gui 
 > support and installed on the server (ubuntu 11.04), is working fine. I'm 
 > querying using the recollq command line interface, from a PHP page 
 > running on the same server, and simply parsing the metadata array. All 
 > good - better than beagle (much better than a dead beagle!), and a 
 > realistic alternative to Microsoft Indexing Service.

Just by the way, someone coded a PHP module for recoll (it's in the "php"
directory in the source), it looks a bit primitive but it would probably be
possible to extend it.

 > But it would be nice to tweak up recollq a little ...
 > 
 > (a) to get the "to" field in the meta-data array in recollq. I can 
 > search on both "from" and "to" but only report "from".

To be able to display the "to" value, You need to add the "recipient" field
to the list of "stored" values. Inside ~/.recoll/fields:

[stored]
recipient=

The "to" value should then appear as "recipient = xxx" inside the answers'
metadata arrays ("recipient" is the internal field name used by recoll,
"to" is an alias).

For more detail, you can look at the base fields file inside
/usr/share/recoll/examples/fields, and there is a little more explanation
there:
http://www.lesbonscomptes.com/recoll/usermanual/rcl.install.config.html#RCL.INSTALL.CONFIG.FIELDS

 > (b) to get a dynamically built abstract in the meta-data array in 
 > recollq (perhaps instead of the static abstract).
 > 
 > I'm not an experienced cpp programmer, but I'm happy to try any code 
 > suggestions to adapt recollq, if someone could give me a few pointers. 
 > Be glad of any help!

recollq is really a test driver for the internal recoll interface, and it's
intended to be modified for specific uses. I expect that the API on
which it is based will remain fairly stable, it's mostly the same layer
used by the GUI and the python and php modules. So it would be really
natural that you keep your own version of the program.

Synthetic abstracts are printed by recollq when option -A is given on the
command line. You can see what it does around line 313 in recollq (look for
OPT_A).

It would be really easy to print the abstract as if it was part of the
metadata array, just change the two lines which print "ABSTRACT" and
"/ABSTRACT", something like:
  cout << "ABSTRACT = ";
 cout << abstract << endl;
 // Delete the other one:  cout << "/ABSTRACT" << endl;

If you are more at ease with script languages, there is a Python recollq
lookalike inside python/samples/recollq.py, this might be even easier to
tailor to your needs.

Cheers,

jf

Other related posts: