lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marvin Humphrey <>
Subject Re: [lucy-user] index and search words separated by hyphens
Date Wed, 06 Jul 2011 23:47:47 GMT
On Thu, Jul 07, 2011 at 01:35:30AM +0200, arjan wrote:
> You asked  how I build the query and this made have another look at how I
> instantiate the QueryParser object. I selected the wrong fields.

Ah, interesting.  :)

> Thanks for asking the right questions and telling me how it should work.

Happy to help, and I'm glad you didn't find a Lucy bug!  :)

For what it's worth, it's useful to know what kinds of mistakes our users
make, as it can help us to refine our API designs so that they shunt people
in the right direction.  (See <>.)

In this case, I think we've already made QueryParser just about as safe as it
can be by having it take a Schema rather than a hard-coded list of fields by
default.  I can't think of a way we could improve the design to spare future
users from the problems you faced.

>> They're in the lexicon?  Do you mean that you've gone all the way down into
>> Lucy::Index::Lexicon, or something else?
> Yes, like so:
> my $polyreader = Lucy::Index::IndexReader->open(
>         index => $env->message_storage,
>     );
> my $seg_readers = $polyreader->seg_readers;
> foreach my $seg_reader ( @$seg_readers ) {
>     say "segment: $seg_reader";
>     my $lex_reader = $seg_reader->obtain( "Lucy::Index::LexiconReader" );
>     my $lexicon    = $lex_reader->lexicon( field => 'title' );
>     while ( $lexicon->next ) {
>         say encode( 'utf8', $lexicon->get_term );
>     }
> }

Nicely done!  You obviously did your homework before coming to the list for

>>> Any help would be appreciated, or is this a bug?
>> How are you building/executing the query?
> Ohhhhh....

LOL!  Been there...

Good luck,

Marvin Humphrey

View raw message