[KinoSearch] Subclassable Highlighter
Father Chrysostomos
sprout at cpan.org
Sun Jan 27 22:46:18 PST 2008
On Jan 27, 2008, at 7:56 PM, Marvin Humphrey wrote:
> How about supplying the query as an argument to Highlighter's
> constructor? That's how Search::Tools::HiLiter works.
>
> my $hiliter = Search::Tools::HiLiter->new(
> query => $query,
> );
>
> my $highlighter = KinoSearch::Highlight::Highlighter->new(
> searcher => $searcher,
> query => $query,
> );
>
> If the 'query' param is just a query string, we can ask $searcher to
> perform its default parsing (currently in
> KinoSearch::Search::Searchable::_prepare_simple_search). If it's an
> object, we assume that it's the same Query object that was supplied
> to $searcher->search.
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
);
Having said that, I can live with it. (You know, we could have the
searcher and query passed to the HitDoc, to avoid the DocVector
overhead you mention.)
_______________________________________________
KinoSearch mailing list
KinoSearch at rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch
More information about the kinosearch
mailing list