KinoSearch::Docs::Tutorial::Highlighter man page on Fedora

Man page or keyword search:  
man Server   31170 pages
apropos Keyword Search (all sections)
Output format
Fedora logo
[printable version]

KinoSearch::Docs::TutoUser:ContributKinoSearch::Docs::Tutorial::Highlighter(3)

NAME
       KinoSearch::Docs::Tutorial::Highlighter - Augment search results with
       highlighted excerpts.

DESCRIPTION
       Adding relevant excerpts with highlighted search terms to your search
       results display makes it much easier for end users to scan the page and
       assess which hits look promising, dramatically improving their search
       experience.

   Adaptations to indexer.pl
       KinoSearch::Highlight::Highlighter uses information generated at index
       time.  To save resources, highlighting is disabled by default and must
       be turned on for individual fields.

	   my $highlightable = KinoSearch::Plan::FullTextType->new(
	       analyzer	     => $polyanalyzer,
	       highlightable => 1,
	   );
	   $schema->spec_field( name => 'content', type => $highlightable );

   Adaptations to search.cgi
       To add highlighting and excerpting to the search.cgi sample app, create
       a $highlighter object outside the hits iterating loop...

	   my $highlighter = KinoSearch::Highlight::Highlighter->new(
	       searcher => $searcher,
	       query	=> $q,
	       field	=> 'content'
	   );

       ... then modify the loop and the per-hit display to generate and
       include the excerpt.

	   # Create result list.
	   my $report = '';
	   while ( my $hit = $hits->next ) {
	       my $score   = sprintf( "%0.3f", $hit->get_score );
	       my $title   = encode_entities( $hit->{title} );
	       my $excerpt = $highlighter->create_excerpt($hit);
	       $report .= qq|
		   <p>
		     <a href="$hit->{url}"><strong>$title</strong></a>
		     <em>$score</em>
		     <br />
		     $excerpt
		     <br />
		     <span class="excerptURL">$hit->{url}</span>
		   </p>
	       |;
	   }

   Next chapter: Query objects
       Our next tutorial chapter, KinoSearch::Docs::Tutorial::QueryObjects,
       illustrates how to build an "advanced search" interface using Query
       objects instead of query strings.

COPYRIGHT AND LICENSE
       Copyright 2008-2010 Marvin Humphrey

       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.14.1			  20KinoSearch::Docs::Tutorial::Highlighter(3)
[top]

List of man pages available for Fedora

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net