lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marvin Humphrey <mar...@rectangular.com>
Subject Re: [lucy-user] Sort Spec problem on Debian Jessie
Date Wed, 27 Jul 2016 22:22:48 GMT
On Wed, Jul 27, 2016 at 2:35 PM, Noe Fernandez <nf232@cornell.edu> wrote:
> Hi Marvin,
>
> I attach a link to a zip file with an example of an index folder and the
> script I am using. It worked on OSX El Capitan and Debian Wheezy
>
> It crashed on Debian Jessie

This problem arises due to a regression in Lucy 5.0.0.  Lucy::Simple prior to
5.x was written in Perl; when it was ported to C, the `search` function ceased
to support `sort_spec`.

I've filed https://issues.apache.org/jira/browse/LUCY-307 to track this issue.

The workaround for now would be to rewrite your code using
Lucy::Search::IndexSearcher instead of Lucy::Simple.  Something like this:

    my $searcher = Lucy::Search::IndexSearcher->new(index => $path_to_index);
    my $sort_spec = Lucy::Search::SortSpec->new(
         rules => [
            Lucy::Search::SortRule->new(field => 'correlation', reverse => 1),
            Lucy::Search::SortRule->new(field => 'gene2', reverse => 0),
            Lucy::Search::SortRule->new(field => 'gene1'),
         ],
    );
    my $hits = $searcher->hits(
        query     => $query,
        sort_spec => $sort_spec,
        num_wanted => 20,
    );

Marvin Humphrey

Mime
View raw message