[lucy-user] Field names with numbers or underscore in the name in Lucy 0.4.0

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[lucy-user] Field names with numbers or underscore in the name in Lucy 0.4.0

Thomas den Braber-2
Hallo,

I am testing the new version 0.40 of Lucy and found that all fields with an
undersore or number in the name can not be searched on with the queryparser:

if in version 0.33 I did:
my $query_parser = Lucy::Search::QueryParser->new(
        schema => $searcher->get_schema,
        fields => ['body'],
);
$query_parser->set_heed_colons(1);
my $query = $query_parser->parse( 'object_name:test' );

and the schema wascreated like:
# Create a Schema to defines index fields.
  my $schema = Lucy::Plan::Schema->new();
  my $normalizer = Lucy::Analysis::Normalizer->new ( strip_accents => 1 );
 
  my $tokenizer  = Lucy::Analysis::RegexTokenizer->new( pattern =>
q|\w+(?:[\x{2019}&']\w+)*|);

  # caseinsensitive string
  my $quickpoly = Lucy::Plan::FullTextType->new(
       analyzer => Lucy::Analysis::PolyAnalyzer->new( analyzers => [
$normalizer, $tokenizer] )
   );$schema->spec_field( name => 'body', type => $quickpoly );
  $schema->spec_field( name => 'object_name', type => $quickpoly );

I get results if the field object_name contains 'test'

In version 0.40 this does not work anymore no hits are returned. Only if I
change  'object_name' to  'objectname' it will.

Is this a bug ?

--
Thomas den Braber
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Field names with numbers or underscore in the name in Lucy 0.4.0

Nick Wellnhofer
On 16/09/2014 12:10, Thomas den Braber wrote:
> In version 0.40 this does not work anymore no hits are returned. Only if I
> change  'object_name' to  'objectname' it will.
>
> Is this a bug ?

Yes, this is likely a bug that I introduced when converting the codebase to
use string iterators. From a quick glance, it seems that this line is wrong:

 
https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=blob;f=core/Lucy/Search/QueryParser/QueryLexer.c;h=f070fb940bb7ffc698189698df4fdc1f6f7b547c;hb=HEAD#l213

Should be '==' instead of '!='. I created an issue in our bugtracker:

     https://issues.apache.org/jira/browse/LUCY-269

Are you sure that numbers in field names cause the same problem? It looks like
only underscores are affected.

Nick

Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Field names with numbers or underscore in the name in Lucy 0.4.0

Thomas den Braber
Nick,

The field names with numbers seem to work, this was my mistake.

--
Thomas
-----Original Message-----
From: Nick Wellnhofer <[hidden email]>
To: [hidden email]
Date: Tue, 16 Sep 2014 12:33:22 +0200
Subject: Re: [lucy-user] Field names with numbers or underscore in the name
in Lucy 0.4.0


On 16/09/2014 12:10, Thomas den Braber wrote:
> In version 0.40 this does not work anymore no hits are returned. Only if I
> change  'object_name' to  'objectname' it will.
>
> Is this a bug ?

Yes, this is likely a bug that I introduced when converting the codebase to
use string iterators. From a quick glance, it seems that this line is wrong:

 
https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=blob;f=core/Lucy/Search/QueryParser/QueryLexer.c;h=f070fb940bb7ffc698189698df4fdc1f6f7b547c;hb=HEAD#l213 
[https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=blob;f=core/Lucy/Search/QueryParser/QueryLexer.c;h=f070fb940bb7ffc698189698df4fdc1f6f7b547c;hb=HEAD#l213]

Should be '==' instead of '!='. I created an issue in our bugtracker:

     https://issues.apache.org/jira/browse/LUCY-269 
[https://issues.apache.org/jira/browse/LUCY-269]

Are you sure that numbers in field names cause the same problem? It looks
like
only underscores are affected.

Nick
Reply | Threaded
Open this post in threaded view
|

Re: [lucy-user] Field names with numbers or underscore in the name in Lucy 0.4.0

Nick Wellnhofer
On Sep 16, 2014, at 13:29 , Thomas den Braber <[hidden email]> wrote:

> The field names with numbers seem to work, this was my mistake.

I committed a fix for field names with underscores. It will be part of the upcoming 0.4.1 release.

Nick