moseley 02/04/06 11:17:17 Modified: src/search .swishcgi.conf SwishSpiderConfig.pl search.tt swish.conf src/search/modules PhraseHighlight.pm Log: Fixed a bug in highlighting code. Now only display the page, not the fragment of the URL (since it was long, and also available as the link to the doc). Shortened the green properties section and display both the entire doc length, and the section length. Revision Changes Path 1.4 +8 -0 modperl-docs/src/search/.swishcgi.conf Index: .swishcgi.conf =================================================================== RCS file: /home/cvs/modperl-docs/src/search/.swishcgi.conf,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- .swishcgi.conf 24 Mar 2002 17:06:38 -0000 1.3 +++ .swishcgi.conf 6 Apr 2002 19:17:16 -0000 1.4 @@ -1,6 +1,14 @@ + + +# Display swish times in GMT + +$ENV{TZ} = 'UTC'; + return { title => 'Search mod_perl Site', prepend_path => '../', # search results are shown one level down + + display_props => [qw/swishlastmodified swishdocsize swishdocpath pagelen/], template => { package => 'TemplateToolkit', 1.8 +6 -0 modperl-docs/src/search/SwishSpiderConfig.pl Index: SwishSpiderConfig.pl =================================================================== RCS file: /home/cvs/modperl-docs/src/search/SwishSpiderConfig.pl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- SwishSpiderConfig.pl 5 Apr 2002 18:28:18 -0000 1.7 +++ SwishSpiderConfig.pl 6 Apr 2002 19:17:16 -0000 1.8 @@ -57,6 +57,8 @@ $tree->parse( ${$params{content}} ); # Why not allow a scalar ref? $tree->eof; + $params{page_length} = length ${$params{content}}; + # Find the <head> section for use in all split pages my $head = $tree->look_down( '_tag', 'head' ); @@ -141,6 +143,10 @@ $head->push_content( $meta ); } + # Add the total document length, which is different than the section length + $head->push_content( + HTML::Element->new('meta', name=> 'pagelen', content => $params->{page_length} ) + ); my $body = HTML::Element->new('body'); 1.9 +7 -3 modperl-docs/src/search/search.tt Index: search.tt =================================================================== RCS file: /home/cvs/modperl-docs/src/search/search.tt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- search.tt 6 Apr 2002 14:42:26 -0000 1.8 +++ search.tt 6 Apr 2002 19:17:16 -0000 1.9 @@ -141,9 +141,11 @@ </dd> <dd> <div class="searchprops"> - Rank: [% item.swishrank %]<br> - [% item.swishdocpath %]<br> - [% item.swishdocsize %] bytes / [% item.swishlastmodified %] + [% item.swishdocpath | replace('#.+', '') %]<br> + Rank: [% item.swishrank %] | + Page: [% item.pagelen / 1000 | format('%2.1f') %]k, + Section: [% item.swishdocsize / 1000 | format('%2.1f') %]k | + [% item.swishlastmodified %] </div> </dd> @@ -151,3 +153,5 @@ [% END %] [% END %] + + 1.7 +2 -1 modperl-docs/src/search/swish.conf Index: swish.conf =================================================================== RCS file: /home/cvs/modperl-docs/src/search/swish.conf,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- swish.conf 24 Mar 2002 17:06:38 -0000 1.6 +++ swish.conf 6 Apr 2002 19:17:16 -0000 1.7 @@ -5,6 +5,7 @@ DefaultContents HTML2 StoreDescription HTML2 <body> 100000 +PropertyNames pagelen # Allow limiting searches by these metanames MetaNames swishtitle swishdocpath section @@ -12,7 +13,7 @@ # And don't index any text from other <meta> tags UndefinedMetaTags ignore -# Add in the _ and : in the middle of a word +# Add in chars [_:] to allow them in the middle of a word WordCharacters _:0123456789abcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ IgnoreFirstChar _: IgnoreLastChar _: 1.2 +3 -2 modperl-docs/src/search/modules/PhraseHighlight.pm Index: PhraseHighlight.pm =================================================================== RCS file: /home/cvs/modperl-docs/src/search/modules/PhraseHighlight.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PhraseHighlight.pm 30 Jan 2002 06:35:00 -0000 1.1 +++ PhraseHighlight.pm 6 Apr 2002 19:17:16 -0000 1.2 @@ -1,7 +1,7 @@ #======================================================================= # Phrase Highlighting Code # -# $Id: PhraseHighlight.pm,v 1.1 2002/01/30 06:35:00 stas Exp $ +# $Id: PhraseHighlight.pm,v 1.2 2002/04/06 19:17:16 moseley Exp $ #======================================================================= package PhraseHighlight; use strict; @@ -162,6 +162,7 @@ for my $match_word ( @$phrase ) { + my $cur_word = $words[ ($word_pos + $end_pos) * 2 ]; unless ( $cur_word =~ /$extract_regexp/ ) { @@ -257,7 +258,7 @@ # All done, and mark where to stop looking if ( $occurrences-- <= 0 ) { - $last = $end; + $last = $stop; last WORD; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]