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
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