[KinoSearch] Subclassable Highlighter

Peter Karman peter at peknet.com
Mon Jan 28 06:26:51 PST 2008





On 01/28/2008 12:46 AM, Father Chrysostomos wrote:
> 
> On Jan 27, 2008, at 7:56 PM, Marvin Humphrey wrote:

> 
> The only thing that bothers me is that the same objects have to be
> passed around so much:
> 
> $hits = $searcher->search( query => $query );
> $highlighter = new KinoSearch::Highlight::Highlighter
>     searcher => $searcher, # I want to eliminate these two
>     query => $query; # extra mentions from user code
> $highlighter ->add_spec(...);
> $hits->create_excerpts(
>     highlighter => $highligher
> );
> 

IIRC, there are places in Search::Tools where, if not present, the query is extracted from
whatever *is* present. E.g. this naive code:

 package KinoSearch::Highlight::Highlighter;
 sub new {
     my $self     = shift;
     my %args     = @_;
     my $searcher = $args{searcher} || croak;
     my $query    = $args{query}    || $searcher->query || croak;
     # yada yada
 }

-- 
Peter Karman  .  peter at peknet.com  .  http://peknet.com/


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




More information about the kinosearch mailing list