You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucy.apache.org by "Nick Wellnhofer (Commented) (JIRA)" <ji...@apache.org> on 2012/02/09 21:30:57 UTC

[lucy-issues] [jira] [Commented] (LUCY-184) Exception is thrown when searching an empty index.

    [ https://issues.apache.org/jira/browse/LUCY-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13204825#comment-13204825 ] 

Nick Wellnhofer commented on LUCY-184:
--------------------------------------

Here's a way to test for an empty index without catching exceptions:

{noformat}
my $reader = Lucy::Index::PolyReader->open( index => $index );
my $is_empty = ! @{ $reader->seg_readers };
{noformat}
                
> Exception is thrown when searching an empty index.
> --------------------------------------------------
>
>                 Key: LUCY-184
>                 URL: https://issues.apache.org/jira/browse/LUCY-184
>             Project: Lucy
>          Issue Type: Bug
>    Affects Versions: 0.2.1 (incubating)
>            Reporter: Trygve Laugstøl
>
> It would be very useful if Lucy didn't throw an exception on an empty index.
> {code}
> Uncaught exception from user code:
> 	Index doesn't seem to contain any data
> 	lucy_IxReader_do_open at /Users/trygvis/.cpan/build/Lucy-0.2.1-ApxzAL/core/Lucy/Index/IndexReader.c line 41
> 	at lib/Hackeriet/Links/Index.pm line 118
>         [snipped]
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira