Range Searching

### Index Up << >>

## Range Searching

Range searching allows you to qualify your search returns with a field that must be within a certain numeric or alphanumeric range. To use it, set the mv_range_look variable to the products database field, or a column/field number for another file. Then set the corresponding mv_range_min and mv_range_max variables with a selectable field.

        <INPUT TYPE="hidden" NAME="mv_range_look" VALUE="price">
            Search on Price
        Min <SELECT NAME="mv_range_min">
                 <OPTION value=0 SELECTED> Free
                 <OPTION value=1000000> $1,000,000
                 <OPTION value=10000000> $10,000,000
                 <OPTION value=20000000> $20,000,000
                 <OPTION value=40000000> $40,000,000
            </SELECT><BR>
        Max <SELECT NAME="mv_range_max">
                <OPTION value=0 SELECTED> no object
                <OPTION value=1000000> $1,000,000
                <OPTION value=10000000> $10,000,000
                <OPTION value=20000000> $20,000,000
                <OPTION value=40000000> $40,000,000
            </SELECT>

The value of 0 for mv_range_max is equivalent to infinity if doing a numeric search. (This makes it impossible to search for a ceiling of 0 with a negative mv_range_min, just in case you were planning on trying that.)

The fields are stackable, so you can set more than one range to check. The order is significant, in the sense that the array of field names and minimum/maximum values must be kept in order to achieve correspondence.

The optional mv_range_alpha specification allows alphanumeric range matching for the corresponding field -- if it is set, and you have stacked the fields, they must all be set. The mv_case field does apply if it is set -- otherwise the comparison is without regard to case.

If you wish to do ONLY a range search, you must select all lines with `mv_return_all`=yes in order to make the search operate. Range-only searches will be quite slow for large databases, since every line must be scanned. It should be quite usable for catalogs of less than 10,000 items in size, given a fast machine. Using it in combination with another search technique (in the same query) will yield faster search returns.

### Index Up << >>