On Wed, Sep 24, 2003 at 07:25:07PM -0500, Ken Jackson wrote:
>
> Bill,
>
> It does work beautifully, however, I want to include in my drop down
> list the ability to search all the indexes at the same time, instead of
> each individually. I don't know how to add that line to the array.
Ah, good point. I've always used checkboxes and just checked all, I
guess.
Here's a 2 line change. It might be a little "perlish".
Index: swish.cgi.in
===================================================================
RCS file: /cvsroot/swishe/swish-e/example/swish.cgi.in,v
retrieving revision 1.11
diff -u -r1.11 swish.cgi.in
--- swish.cgi.in 24 Sep 2003 20:34:12 -0000 1.11
+++ swish.cgi.in 25 Sep 2003 01:10:30 -0000
@@ -1399,7 +1399,8 @@
$self->errstr('Invalid source selected');
return $self;
}
- my @idx = @indexes[ @selected_indexes ];
+ my %dups;
+ my @idx = grep { !$dups{$_}++ } map { ref($_) ? @$_ : $_ } @indexes[ @selected_indexes ];
$self->swish_command( '-f', \@idx );
Then you can define indexes like this:
swish_index => ['index1', 'index2', [ 'index1', 'index2' ] ],
So the third element of that array of indexes is actually another array
of index names.
Then you setup select indexes as:
select_indexes => {
method => 'radio_group',
labels => [ 'Main Index', 'Other Index', 'Both Indexes' ],
},
So you can see with that you can have any groups of indexes you like.
I wouldn't go too crazy with a lot of indexes -- things seem to slow
down when searching a bunch of indexes.
That patch above isn't complete in that if you disable "select_indexes"
then you will see an error like:
Index file error: Could not open the index file 'ARRAY(0x8155adc)': No such file or directory
but it's enough to get you going for now.
--
Bill Moseley
moseley@hank.org
Received on Thu Sep 25 01:29:23 2003