Perlfect Solutions
 

[Perlfect-search] Re: Results

Charles Chilcote perlfect-search@perlfect.com
Thu, 5 Feb 2004 16:15:15 -0500
This is a multi-part message in MIME format.

------=_NextPart_000_0033_01C3EC03.3DAB4F40
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

>
>Thanks for your help with indexing PDFs. It now works.
>
>Is there any way of changing the number of results per page? Also can =
it =3D
>be customized so PDFs open in a new window, ie add target=3D3D"_blank" =
to =3D
>the PDF's A tag?
>
>cheers
>
>

Greetings,

I also wanted the pdf links to open in a new window.  Although I imagine =
this isn't the prettiest code, it seems to get the job done. =20

I suppose an extension list variable could be created in the conf.pl =
file to determine what file types would cause a new window, and then use =
that for the comparison instead the hard-coded "pdf" value below.

I added this code to the cast_template subroutine.  Red=3DNew, =
Blue=3DOriginal=20

    my $cscext =3D get_suffix($url);
    if($cscext ne "pdf") {
    $template->cast_loop ("results", [{rank =3D> $first+(++$rank),=20
                       url =3D> $url,
                       highlight_link =3D> $highlight_link,
                       visibleurl =3D> $visible_url,=20
                       title =3D> $title,=20
                       date =3D> $date,=20
                       score =3D> $score,
                       description =3D> $desc,
                       size =3D> sprintf("%.0f", $sizes_db{$_}/1000) || =
1,
                      }]);
    }
    else {
    my $blankpage =3D '" target=3D"_blank';
    $template->cast_loop ("results", [{rank =3D> $first+(++$rank),=20
                       url =3D> $url . $blankpage,
                       highlight_link =3D> $highlight_link,
                       visibleurl =3D> $visible_url,=20
                       title =3D> $title,=20
                       date =3D> $date,=20
                       score =3D> $score,
                       description =3D> $desc,
                       size =3D> sprintf("%.0f", $sizes_db{$_}/1000) || =
1,
                      }]);   =20
    }


Charles Chilcote
Programmer/Analyst
Nitterhouse Concrete Products, Inc.
http://www.nitterhouse.com/Home.html
------=_NextPart_000_0033_01C3EC03.3DAB4F40
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>
<DIV>&gt;<BR>&gt;Thanks for your help with indexing PDFs. It now =
works.</DIV>
<DIV>&gt;<BR>&gt;Is there any way of changing the number of results per =
page?=20
Also can it =3D<BR>&gt;be customized so PDFs open in a new window, ie =
add=20
target=3D3D"_blank" to =3D<BR>&gt;the PDF's A tag?</DIV>
<DIV>&gt;<BR>&gt;cheers<BR>&gt;</DIV>
<DIV>&gt;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Greetings,</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I also wanted the&nbsp;pdf links to open in a new=20
window.&nbsp; </FONT><FONT size=3D2>Although I imagine this isn't the =
prettiest=20
code,&nbsp;it seems to get the job done.&nbsp; </FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I suppose an extension list variable could be =
created in the=20
conf.pl file to determine what file types would cause a new window, and =
then use=20
that for the comparison instead&nbsp;the hard-coded "pdf" value=20
below.</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>I added this code to the&nbsp;</FONT><FONT=20
size=3D2>cast_template subroutine.&nbsp; Red=3DNew, =
Blue=3DOriginal&nbsp;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3D"MS Sans Serif"><FONT =
color=3D#ff0000>&nbsp;&nbsp;&nbsp; my=20
$cscext =3D get_suffix($url);<BR>&nbsp;&nbsp;&nbsp; if($cscext ne "pdf") =

{<BR></FONT><FONT color=3D#0000ff>&nbsp;&nbsp;&nbsp; =
$template-&gt;cast_loop=20
("results", [{rank =3D&gt; $first+(++$rank),=20
<BR>&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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
description =3D&gt;=20
$desc,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
size =3D&gt; sprintf("%.0f", $sizes_db{$_}/1000) ||=20
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}]);<BR></FONT><FONT color=3D#ff0000>&nbsp;&nbsp;&nbsp; =
}<BR>&nbsp;&nbsp;&nbsp;=20
else {<BR>&nbsp;&nbsp;&nbsp; my $blankpage =3D '"=20
target=3D"_blank';<BR>&nbsp;&nbsp;&nbsp; $template-&gt;cast_loop =
("results",=20
[{rank =3D&gt; $first+(++$rank),=20
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
url =3D&gt; $url .=20
$blankpage,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;=20
highlight_link =3D&gt;=20
$highlight_link,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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T></DIV>
<DIV><FONT face=3D"MS Sans Serif"></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Charles Chilcote</FONT></DIV>
<DIV><FONT size=3D2>Programmer/Analyst</FONT></DIV>
<DIV><FONT size=3D2>Nitterhouse Concrete Products, Inc.</FONT><BR><FONT =
size=3D2><A=20
href=3D"http://www.nitterhouse.com/Home.html">http://www.nitterhouse.com/=
Home.html</A></FONT></DIV></DIV></BODY></HTML>

------=_NextPart_000_0033_01C3EC03.3DAB4F40--