Hi all,
First of all I would like to thanks all of you for making this thread. I made the changes you suggested so that the search with custom=1 works and it does =).
I would also add that by commenting the line in "search.cgi":
Code:
($in->param('custom') && keys %filter > 0) or &site_html_search_failure ( { error => "Must Set One Parameter.", %in }, $dynamic) and return;
The query search and the custom search work but you need to put them in separate FORM action.
I also want to tell you that I manage to make the range searches work (modification are made in DBSQL.pm).
Replace:
Code:
my @search_fields = (); my @lt_fields = (); my @gt_fields = (); my $search_index = '';
with:
Code:
my @search_fields = (); my @lt_fields = (); my @gt_fields = (); my @gt_lt_fields = (); my $search_index = '';
then after:
Code:
foreach my $column (@{$self->{'db_cols'}}) {
add these lines (the 2 last where already there if you read and followed the thread):
Code:
($opt_r->{$column} =~ /^\[(.+)\]$/) and do { $opt_r->{"$column"} = $1; print "$column - $opt_r->{$column}<br>"; push(@gt_lt_fields, $column); next; };
($opt_r->{$column} =~ /^>(.+)$/) and do { $opt_r->{"$column"} = $1; push(@gt_fields, $column); next; };
($opt_r->{$column} =~ /^<(.+)$/) and do { $opt_r->{"$column"} = $1; push(@lt_fields, $column); next; };
then replace:
Code:
if (!@search_fields and !@gt_fields and !@lt_fields) {
with:
Code:
if (!@search_fields and !@gt_fields and !@lt_fields and !@gt_lt_fields) {
add before:
Code:
foreach my $field (@lt_fields) {
these lines:
Code:
foreach my $field (@gt_lt_fields) {
$value_q = $DBH->quote($opt_r->{$field});
$value_q =~ /^'(.+)-(.+)'$/;
$where .= qq!
($field >= $1 AND $field <= $2) $bool!;
}
and to have a correct range search you must use number not string so after:
Code:
foreach my $field (@lt_fields) {
$value_q = $DBH->quote($opt_r->{$field});
and
Code:
foreach my $field (@gt_fields) {
$value_q = $DBH->quote($opt_r->{$field});
add those 2 lines:
Code:
$value_q =~ /^'(.+)'$/;
$value_q = $1;
With there changes you now can range search =)
for greater than: ?variable=>10
for lower than: ?variable=<10
for a certain rage: ?variable=[0-10]
...
Any question?
------------------
Dann Cohen
Toxik Technologies Inc. - Montreal, Quebec, Canada
www.toxik.com