Muffins writes


I’m following the docs [here]( to create a small script that searches our archive via a web interface and returns the results via json.

My query is relating to the use of -n to slice (i.e. paginate) the results set. An example of the query I am using is below.


recoll -t -f -n '20-10' -F 'filename mtype mtime relevancyrating rcludi' 'searchstr'

The docs would suggest that this would return 10 results, starting from the 20th. However it actually seems to return 20 results, starting from 0.

    -n [first-]<cnt > define the result slice. The default value for [first]
       is 0. Without the option, the default max count is 2000.
       Use n=0 for no limit

I’ve also tried many other variations in case the script is expecting a slightly different syntax…


recoll -t -f -n '20:10' -F 'filename mtype mtime relevancyrating rcludi' 'searchstr'
recoll -t -f -n '20 10' -F 'filename mtype mtime relevancyrating rcludi' 'searchstr'
recoll -t -f -n 20-10 -F 'filename mtype mtime relevancyrating rcludi' 'searchstr'
recoll -t -f -n '[20]-10' -F 'filename mtype mtime relevancyrating rcludi' 'searchstr'

EDIT: I’m using Version: 1.16.2-1 from the Ubuntu 12.04 repos on Ubuntu server.

Is this a bug or is it just me being stupid? :D

Any help is greatly appreciated!

medoc writes

I think that the issue is that this form of query was not supported in 1.16. The online docs are for 1.18, the current release.

The atoi() call used to convert the argument does not care about the whole string, it just converts the first number, which is probably why you don’t get an "Usage()" error and see the results you are seeing instead.

There are a number of possible workarounds:

  • Most simply, upgrade to 1.18, by using the PPA

  • Else, you can keep 1.16 and just fix the recollq.cpp program to handle the option (it’s purely a trivial interface issue, the underlying 1.16 code can handle the slices). I could easily produce a patch for recollq.cpp, it’s really a few lines to change. Then compile recollq from source.

  • You could also walk around the problem by doing the slicing in your script. Just require more and more results, and just keep the last ones. This is wasteful, but you may find out that the performance is ok anyway, and it’s close to what Xapian does internally…

Of course a better approach to using recoll -t or recollq would be to use the Python interface :)


Muffins writes

Thanks, didn’t realise you had a PPA. All working great now! :)