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

Subject Author Views Date
Thread Line Search with Widgetz - Eliot Grep Code sanuk 2104 May 15, 2001, 11:57 AM
Thread Re: Line search with Eliot grep-code
sanuk 2034 May 17, 2001, 1:37 AM
Thread Re: Line search with Eliot grep-code
Stealth 2023 May 17, 2001, 7:00 AM
Post Re: Line search with Eliot grep-code
Robbie 2011 May 17, 2001, 3:20 PM
Thread Re: Line search with Eliot grep-code
sanuk 1990 May 17, 2001, 8:30 PM
Post Re: Line search with Eliot grep-code
sanuk 1906 May 20, 2001, 7:38 PM