On Tue, 2003-10-21 at 15:22, rikona wrote:
> Hello Jack,
...
>
> JC> swish-e looks great and is on my to-try list.
>
> This does look good, and better than any suggestions made when I asked
> earlier. Thanks. The part that I missed right away when I tried the
> demo was the ability to do proximity searches ((search or find)
> [within 25 words of] (script and text)). This is a very powerful
> capability that I have come to like a lot. The demos also did not like
> complex nested expressions, and did not do them correctly, although
> the documentation said it did seem to use regex, which I didn't try.
>
> The other thing I like about DTsearch is the great number of formats
> it can index, and then display in an integrated viewer. I can scroll
> through 15 different formats, seeing the contents of each one, as fast
> as I can press a key. In a very large document, the viewer also shows
> each occurrence of the search word(s), and you can scroll through them
> from find to find very easily. The integrated viewer is VERY nice.
>
> Is there a way to get the output of swish-e to operate as an
> 'integrated viewer'?
>
I don't know for sure, but I think that Nautilus or Konqueror would fit
the bill there. Both have intense MIME capabilities.
> JC> ht::dig is kinda lame, but generally works.
>
> This was suggested earlier. Not a candidate.
>
> JC> if your data is in a database or can get there, finding or writing
> JC> a search interface from your favorite language is really not hard.
>
> Are you suggesting the full DTsearch capabilities are easy to do? If
> so, tell me more. :-) It would be a very nice addition to open source
> programs, IMHO.
>
that viewer sounds tough, but here's a two function CGI web search
interface that uses MS-SQL as its backend:
sub ParsifySearchString ($) {
my ($input_string) = @_;
my @search_strings;
my $search_string = '';
my $quote_marker = 0;
@search_strings = split (/\s+/, $input_string);
foreach my $string (@search_strings) {
# MS-SQL chokes on these
if ($string =~
/\bis\b|\bof\b|\bbecause\b|\bwas\b|\bmany\b|\btoo\b|\bfor\b|\bwhile\b|\bthe\b|\ba\b|\ban\b|\bthis\b|\bthose\b|\bthese\b|\bthem\b|\bme\b/i)
{
next;
}
if ($string =~ /\band\b|\bor\b|\bnot\b/i) {
$search_string .= $string." ";
next;
}
if ($string =~ /\"/ && $quote_marker == 0) {
$search_string .= $string." ";
$quote_marker = 1;
next;
}
if ($string =~ /\"/ && $quote_marker == 1) {
$search_string .= $string." ";
$quote_marker = 0;
next;
}
if ($quote_marker == 1) {
$search_string .= $string." ";
} else {
$search_string .= "\"".$string."\" ";
}
}
chop $search_string;
$search_string =~ s/^\s|\"\"//;
$search_string =~ s/\" \"/\" AND \"/g;
$search_string =~ s/(\w+\") not (\"\w)/$1 AND NOT $2/i;
push(@search_strings, $search_string);
return @search_strings;
}
sub SearchDB ($) {
my ($cgi) = @_;
# get the input query
my $input_string = $cgi->param('search');
my @search_strings = &ParsifySearchString($input_string);
my $search_string = pop(@search_strings);
my $query = "SELECT
Rank,ticket_id,subject,who,time_incoming,contents FROM
CONTAINSTABLE(support_emails, *, '$search_string') AS ct JOIN
support_emails AS e ON ct.[KEY] = e.id WHERE Rank > 0 ORDER BY
ticket_id";
my $ticket_test = 0;
# Start the web page
print $cgi->header(-type => 'text/html');
print $cgi->start_html(
-title => "Search Results: $search_string",
-bgcolor => '#ffffff',
);
#print "<h1>$search_string</h1>";
if (!$search_string) {print "<B>Unable to process query, please
try again.</B>\n"; exit(1);}
# Keep the whole table in output so it can be used from other
pages.
my $output = "<TABLE BORDER=1 BGCOLOR=\"#c0c0c0\">\n";
$output .= "<TR><TD ALIGN=\"CENTER\"><H2><A
HREF=\"http://...\">Support Web Home</A></H2>";
$output .= "<FORM METHOD=POST
ACTION=\"/cgi-bin/supportWeb.pl\">";
$output .= "<INPUT TYPE=\"hidden\" name=\"page\"
value=\"search\">";
$output .= "<INPUT SIZE=15 name=search value=\"\">";
$output .= "<INPUT TYPE=submit value=\"Search Tickets\">";
$output .= "<br></form></TD></TR>\n";
$output .= "<TR><TD ALIGN=\"CENTER\">Searched the Support
database for <B>$search_string</B>.<BR>\n";
# $output .= "<FONT SIZE=\"-3\">$query.</FONT></TD>";
$output .= "</TR></TABLE><P>\n<TABLE BORDER=1
BGCOLOR=\"#6a8d9c\" CELLPADDING=5 FONT SIZE=\"-1\">\n";
$output .=
"<TR><TD><B>TICKET</B></TD><TD><B>SUBJECT</B></TD><TD><B>AUTHOR</B></TD><TD><B>TIME</B></TD></TR>\n";
$dbh->do("set textsize 20000000");
my $sth = $dbh->prepare($query) or print "Unable to prepare
query ($query): ".$dbh->errstr;
$sth->execute or print "Unable to execute query ($query):
".$dbh->errstr;
# Stuff the results into our table
while (my @row = $sth->fetchrow_array) {
my
($rank,$ticket_id,$subject,$who,$time_incoming,$contents) = @row;
if ($ticket_id != $ticket_test) {
$output .= "<TR><TD><A
HREF=\"/cgi-bin/supportWeb.pl?thread=$ticket_id\">$ticket_id</A></TD><TD>$subject</TD><TD>$who</TD><TD>$time_incoming</TD></TR>\n";
# Parse and print the message contents
my $msg_summary="\n";
$contents =~ s/</</g;
$contents =~ s/>/>/g;
my @contents = split(/\r?\n/,$contents);
foreach my $line (@contents) {
foreach my $string (@search_strings) {
if ($string =~ /\band\b|\bor\b|\bnot\b/)
{
next;
}
if ($line =~ /$string/i) {
$msg_summary .= LineWrap($line."\n");
}
}
}
$output .= "<TR><TD COLSPAN=4
BGCOLOR=\"#FFFFEF\"><PRE>$msg_summary</PRE></TD></TR>";
}
$ticket_test = $ticket_id;
}
$sth->finish;
$output .= "</TABLE>\n";
# print the goods
print $output;
# close the web page
print $cgi->end_html;
exit(0);
}
> Thanks for the info.
--
Jack Coates
Monkeynoodle: A Scientific Venture...
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com