[KinoSearch] Wildcards

Marvin Humphrey marvin at rectangular.com
Fri Jan 25 11:41:17 PST 2008




On Jan 25, 2008, at 8:40 AM, Father Chrysostomos wrote:

>> However any particular WildcardQuery gets implemented, it will  
>> need some sort of safety valve to prevent "a*" from swamping the  
>> server.
>
> You mean like this?
>
> KSx::Search::RegexpQuery->new(
>     re => qr/^foo.*/,
>     field => 'content',
>     max_terms => 1024,
> );

Yes, that would work.

It would probably be best if exceeding max_terms in the constructor  
caused an exception object to be thrown, allowing code like this:

    my $query = eval {
      KSx::Search::RegexpQuery->new(
        re => qr/^foo.*/,
        field => 'content',
        max_terms => 1024,
      );
    };
    my $exception = $@;
    if ( ref($exception) and $exception->isa('MyCustomException') ) {
       tell_user_about_error($exception);
    }

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/

_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch




More information about the kinosearch mailing list