[ic] Search routine

Martin Abell interchange-users@icdevgroup.org
Wed Jan 29 11:00:01 2003


I have a question about a search.  First let me say that I did try the
searchable archive and it came up with some promising hits, but the
drill-down to an article gave 404 errors (rejection from RedHat).  So is
there another way to do this?

The search I'm attempting is to find the word(s) typed in the search field
within some of the product db fields (description, comment, sku, price) but
eliminate any in the "specials" category.  (There is no "specials" category
in the cat db, but some items in the products db have category = specials.)
In other words, we want to keep the casual visitor from finding the
specials.

Here's what I tried:

<FORM ACTION="[area search]" method="post">
  <INPUT TYPE=hidden NAME=mv_searchtype VALUE=sql>
  <INPUT TYPE=hidden NAME=mv_matchlimit VALUE=4>
  <INPUT TYPE=hidden NAME=mv_sort_field VALUE=category>
  <INPUT TYPE="hidden" NAME="mv_search_page" VALUE="results_big">
           
  <input type="hidden" name="mv_coordinate" value="yes">

  <input type="hidden" name="mv_search_field" value="category">
  <INPUT TYPE="hidden" NAME="mv_column_op" VALUE="rn">
  <input type="hidden" name="mv_substring_match" value="no">
  <INPUT type="hidden" name="mv_searchspec" value="special">

  <INPUT TYPE="hidden" NAME="mv_search_field"
      VALUE="sku,description,comment,price">
  <INPUT TYPE="hidden" NAME="mv_column_op" VALUE="em">
  <input type="hidden" name="mv_substring_match" value="yes">
  <INPUT MAXLENGTH=30 NAME="mv_searchspec" type=text size=10>
 (submit button)
</form>

This returns (along with other items) my item in the "specials" category,
which I didn't want.  (I typed in "spec" which appears in a number of the
comment fields.)

And I've tried a number of variations (changed order of statements,
column_op="!=", etc.) and got various results, but none what I want.  I even
tried using a mysql_query, with no improvement:
   <input type="hidden" name="mv_sql_query"
    value="select sku from products where (sku like mv_searchspec
        or description like mv_searchspec
        or comment like mv_searchspec or
        price like mv_searchspec)
        and category != 'special'">

Anybody done this sort of thing before?

Martin Abell
SpeedSpan