Skip to main content.
home | support | download

Back to List Archive

multiple query forms with swish.cgi?

From: Thomas M. Parris <parris(at)not-real.isciences.com>
Date: Tue Aug 06 2002 - 16:10:29 GMT
Dear SWISHers:

I have been working with swish.cgi to put up a search intereface to a
bibliographic database.  All of the searchable fields are defined/indexed as
metatags.  I have been able to use swish.cgi to put up a basic front end.
However, my desires go a bit beyond what is documented and I am wondering if
there is a simple way to get what I want.

I want a form that allows multiple search strings (one for each searchable
metatag) with an implicit AND between the searches.  For example:

Title:    [fill in the blank                 ]
Author:   [fill in the blank                 ]
Subject:  [pull down menu                    ]
Year:     [fill in the blank                 ]
[SUBMIT]

The current configuration options seem to only allow for a single fill in
the blank field (via metanames) and a single field defined on the content of
a metatag (via select_by_meta).  However, the select_by_meta method is
implemented as a limit (i.e., it does not stand alone as a search, it
requires that the search field have something in it).

I'm guessing that you will tell me to hack away at build_query and
TemplateDefault::get_meta_name_limits to do what I want.  But, I wanted to
make sure I wasn't overlooking the obvious.  If there is an easy way to do
this, stop now and tell me.  Otherwise, read further to see how I sould hack
swish.cgi.

If I was to hack away at these modules, I would probably build a loop over
query variables (e.g., query1 ... queryn) and make the metanames
configuration option an element of a searchfield structure.  For each
searchfield, I would also provide options similar to that for
select_by_meta. Finally, I would provide an option for how the searches
should be connected.  For example:

searchfields => [
	{
		metanames   => [qw/Title/],
		description => "Title:",
		method      => 'text_field' # could also be 'radio_group',
'checkbox_group', or 'popup_menu'
            length      => 20, # length of field, only ysed for text and
popup.
		columns     => 3, # only used for radio and checkbox
		values      => ['Value 1', 'Value 2', 'Value 3'], # only used for radio,
checkbox, popup.
		labels      => ['Label 1', 'Label 2', 'Label 3'], # only used for radio,
checkbox, popup.
	},

	{
		metanames   => [qw/Subject/],
		description => "Subject:",
		method      => 'popup_menu' # could also be 'radio_group',
'checkbox_group', or 'popup_menu'
            length      => 20, # length of field, only ysed for text and
popup.
		columns     => 3, # only used for radio and checkbox
		values      => ['SUBJ1', 'SUBJ2', 'SUBJ3'], # only used for radio,
checkbox, popup.
		labels      => ['Subject 1', 'Subject 2', 'Subject 3'], # only used for
radio, checkbox, popup.
	}
],

searchconnector => 'AND', # can be 'AND', 'OR', 'USER' (where 'USER' put out
a pulldown form element).


Would there be interest in incorporating such a hack into the main
distribution?

-- Tom

p.s. I would be great if there were a swish method to get the list of
database values for a given metaname.  This would simplify the process of
specifying radio_group, checkbox_group, and popup_menu items.

------------------------------------------------------
Thomas M. Parris
Research Scientist & Executive Director, Boston Office
ISCIENCES, LLC
685 Centre Street, Suite 207
Jamaica Plain, MA  02130
voice: 617.524.8041          http://www.isciences.com/
fax:   509.463.4679          http://www.terraviva.net/
email: parris@isciences.com
------------------------------------------------------
Received on Tue Aug 6 16:14:06 2002