I've got a boolean field in my index, I mark the field as unanalyzed,
then store the string '1' (without the quotes) to mean true. I search
for a string + bool_field=1 and I get the hits I want, but the
highlighter doesn't care which field I was looking for a term in. All
the 1s in my body field get highlighted. He is a short code sample,
let me know if you want more, or a more concrete example:
my $query_string = 'this is a query string';
my $query = KinoSearch::Search::BooleanQuery->new;
$query->add_clause( query => $query_string, occur => 'MUST' );
my $bool = KinoSearch::Search::TermQuery->new(
term => KinoSearch::Index::Term->new( bool_field => '1' )
);
$query->add_clause( query => $bool, occur => 'MUST' );
my $hits = $searcher->search( query => $query );
my $highlighter = BigMunch::Highlighter->new( fields => [ 'body' ] );
$hits->create_excerpts( highlighter => $highlighter );
--
Edward Betts
then store the string '1' (without the quotes) to mean true. I search
for a string + bool_field=1 and I get the hits I want, but the
highlighter doesn't care which field I was looking for a term in. All
the 1s in my body field get highlighted. He is a short code sample,
let me know if you want more, or a more concrete example:
my $query_string = 'this is a query string';
my $query = KinoSearch::Search::BooleanQuery->new;
$query->add_clause( query => $query_string, occur => 'MUST' );
my $bool = KinoSearch::Search::TermQuery->new(
term => KinoSearch::Index::Term->new( bool_field => '1' )
);
$query->add_clause( query => $bool, occur => 'MUST' );
my $hits = $searcher->search( query => $query );
my $highlighter = BigMunch::Highlighter->new( fields => [ 'body' ] );
$hits->create_excerpts( highlighter => $highlighter );
--
Edward Betts