Gossamer Forum
Home : Products : Links 2.0 : Customization :

Line Search with Widgetz - Eliot Grep Code

Quote Reply
Line Search with Widgetz - Eliot Grep Code
Hi to all,
I adapted my search.cgi with the Grep code posted by Eliot some time (years ago) !!!!!!

I found some days ago a topic concerning searching the whole line instead of searching field by field.
But a solution too this topic WAS NOT FOUND.
I have the problem that I am using a "Keyword Field"
So if:
"word-1" is in the "description field"
and
"word-2 is in the "keyword field"
then
searching for "word-1" AND "word-2"
using the AND connector brings back no search-results

Does anyone know how too change this code as too search the complete db-line at once instead of field by field.

I am using the grep code that was posted some time ago by Eliot in this forum:

open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name. Reason: $!");
flock (DB, 1) if ($db_use_flock);
@db = <DB>;
close DB;
$grand_total = $#db+1;
foreach (grep {!/^#/ and !/^\s*$/ and &{$regexp}} @db) {
@values = &split_decode($_);
FIELD: foreach $field (@search_fields) {
$_ = $values[$field];
if (&{$regexp}) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++;
last FIELD;
}
}
$_ = $values[$db_category];
push (@category_results, $values[$db_category]) if (!$seen{$_}++ && &{$regexp});
}

Thanks and Regards,
Sanuk

Quote Reply
Re: Line search with Eliot grep-code In reply to
Oooooops !!!!!!!
I made a mistake
This grep search code was originaly made by Widgetz
and comes out of a discussion topic with Eliot & Widgetz
Sorry and Regards,
Sanuk

Quote Reply
Re: Line search with Eliot grep-code In reply to
That's correct...jerry su is the one who wrote the original codes, however, I did enhance the codes to make it work better.

Regards,

Eliot Lee
Quote Reply
Re: Line search with Eliot grep-code In reply to
Of coz u did, Eliot, of coz u did.

Now help the guy?

Quote Reply
Re: Line search with Eliot grep-code In reply to
Hello friends,
Thank You for your interest in this topic.
But does anyone know how to change the above Code
as to do a complete Line-Search
instead of searching Field by Field
Please HELP because I really need this one.
Thanks and Regards,
Sanuk

Quote Reply
Re: Line search with Eliot grep-code In reply to
Is this very difficult to do
Can No One help one this One:

I have tried changing FIELD to LINE but it does not work:

LINE: foreach $line (@search_lines) {
$_ = $values[$line];
if (&{$regexp}) {
push (@{$link_results{$values[$db_category]}}, @values);
$numhits++;
last LINE;

Please help someone

Regards,
Sanuk