MiniVend will do a complete range of tests on individual columns in the database. To use this function, set mv_coordinate to yes (co=yes in the one-click syntax).
In order to use coordinated searching, the number of search fields must equal the number of search strings. This makes sense if you think about it a bit.
If you want to make sure that is the case, use the mv_search_map
variable. It allows you to map variables to others in the search
specification. For example:
<INPUT TYPE=hidden NAME=mv_search_map VALUE="
mv_searchspec=search1
mv_searchspec=search2
mv_searchspec=search3
">
<INPUT TYPE=hidden NAME=mv_search_field VALUE=title>
<INPUT TYPE=hidden NAME=mv_search_field VALUE=artist>
<INPUT TYPE=hidden NAME=mv_search_field VALUE=category>
Artist: <INPUT NAME=search1 VALUE="">
Title: <INPUT NAME=search2 VALUE="">
Genre: <INPUT NAME=search3 VALUE="">
Even if the user leaves one blank, the search will work.
Leading/trailing whitespace is stripped from all lines in the mv_search_map variable, so you can position it as shown for convenience.
Coordinated searches may be joined with the output of another table if you
set one of the mv_search_field values to a table:column
pair. Note that this will slow down large searches considerably unless you
have another search specification, as the database must be accessed for
every search line! If you have a search field that qualifies for a regular
expression search function, or are doing a binary search with
mv_dict_look, or are not doing an OR search, the penalty should not be too great as only matching lines will
cause an access to the database.
Individual field operations can then be specified with the mv_column_op
(or op) parameter. The operations include:
operation string numeric equivalent
---------
equal to eq == =
not equal ne != <>
greater than gt >
less than lt <
less than/equal to le <=
greater than/equal to ge >=
regular expression rm =~ , LIKE
regular expression NOT rn !~
exact match em
An example:
[page scan
co=yes
sf=title
se=Sunflowers
op=em
sf=artist
se=Van Gogh
op=rm ] Sunflowers, Van Gogh [/page]
[page search="
co=yes
sf=title
se=Sunflowers
nu=0
op=!~
sf=artist
se=Van Gogh
op=rm
nu=0
sf=inventory:qty
se=1
op=>=
nu=1
"] Any in stock except Sunflowers, Van Gogh [/page]
Note that in the second example you need to specify nu=0 even though that is the default. This is to set the proper correspondence. To avoid having to do this, use MiniVend's option array feature:
[page search.0="
sf=title
se=Sunflowers
op=!~
"
search.1="
sf=artist
se=Van Gogh
"
search.2="
sf=inventory:qty
se=1
op=>=
nu=1
"
] Any in stock except Sunflowers, Van Gogh [/page]
The co=yes is assumed when specifying a multiple search.
The second search will check the stock status of the painting provided
there is an inventory table as in some of the MiniVend demo catalogs. If the qty field is greater than or equal to 1, then the product will be picked. If
out of stock, it will not be found.
It always helps to have an rm type included in the search. This is used to pre-screen records so that
database accesses only need be made for already-matching entries. If
accesses must be made for every record large searches can get quite slow.