Multi-Field Search Syntax?
10 posts by 3 authors in: Forums > CMS Builder
Last Post: February 13, 2009 (RSS)
By DHester - January 19, 2008 - edited: January 19, 2008
<h5>Keyword Search:</h5>
<form method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="text" name="title_keyword" value="" size="15">
<input type="submit" name="" value="Search">
</form>
In the example above I'm searching the "Title" field. Ideally I'd like to search both my "title" and "content" fields. I can't figure out how to query 2 fields with one search? Can someone point me in the right direction?
Thanks!
www.designsbydarren.com
Re: [DHester] Multi-Field Search Syntax?
By Dave - January 19, 2008
Just list them one after another with the search type on the end. Like this: title,content_keyword
Let me know if that does the trick.
interactivetools.com
Re: [Dave] Multi-Field Search Syntax?
By DHester - January 20, 2008
I appreciate all your help!
www.designsbydarren.com
Re: [Dave] Multi-Field Search Syntax?
By studio-a - December 6, 2008 - edited: December 8, 2008
I have created a quick search feature from a web form drop menu, see code below. Base on the information within the help section (http://www.interactivetools.com/docs/cmsbuilder/viewer_search.html), we can search more than one field.
My Question: Can we combine a search with more than one field WITH a search condition? My search results are not accurate when I try to search with both requests.
<select name="dress_price" onChange="MM_jumpMenu('self',this,1)">
<option value="#" selected>Search By Price:</option>
<option value="myDomain/ListingsWeddings.php?salePrice,price_max=1000">$50 to $999</option>
<option value="myDomain/ListingsWeddings.php?salePrice,price_min=999&salePrice,price_max=3000">$1,000 to $2,999</option>
<option value="myDomain/ListingsWeddings.php?salePrice,price_min=2999">$3,000 and Above</option>
</select>
My results have no error messages. HOWEVER, some of the results display records that do not match the price minimum and maximum search. The “price” field and “salePrice” field are text boxes within the CMS. I changed the sale_price field to salePrice in case the underscore was creating a problem, still finding inaccurate results.
Let me know if decimals within the text field would cause complications. I have tested it with and without decimals, still no errors messages yet inaccurate results. [unsure] Again, the only time an accurate result is found is when I do NOT search with a combination and condition request. Unfortunately, both fields are required for the search to be useful.
[font "Verdana"]One thing I did notice, if I want to create a search for items with a price of $999.00 or lower I needed to set the maximum number within the search to be 1000 (one number above). I would have thought the maximum amount would be included and stop at that amount. Instead I needed to go one digit higher (or lower which ever the case may be). Please let us know if this is true.
I look forward to your help in solving my search problem. Thanks,
Re: [studio-a] Multi-Field Search Syntax?
By Dave - December 8, 2008
I want to do a little more research on this one. I'll get back to you shortly. Stay tuned. :)
interactivetools.com
Re: [studio-a] Multi-Field Search Syntax?
By Dave - December 9, 2008
Thanks for your patience.
>I would have thought the maximum amount would be
>included and stop at that amount.
I wasn't able to recreate this issue locally. If you have price_max=999 that should include records with a price of 999.
You can combine fields with a search but you'll get an "OR" search. So for example this: salePrice,price_max=1000 will essentially perform this query: (`salePrice`<= '999' OR `price`<= '999')
So if either salePrice or price is less than 999 it will return the record.
The other thing to watch for is that you only have numeric values in your prices (numbers and decimal ("."), no commas or dollar signs) or you won't get accurate results. You can restrict what characters are allowed in a field in the field editor.
If you're still getting strange results feel free to email me CMS and FTP login details (email, don't post in the forum) and I can take a look for you.
Hope that helps!
interactivetools.com
Re: [Dave] Multi-Field Search Syntax?
I am still having complications with the minimum search syntax. I emailed support@interactivetools.com with your name in the subject line. I look forward to your reply!
Thanks
Re: [studio-a] Multi-Field Search Syntax?
By Dave - January 22, 2009
Feel free to email me the ticket number to dave@interactivetools.com and I can take a closer look.
interactivetools.com
Re: [Dave] Multi-Field Search Syntax?
Thanks for the invitation. I did send and email, but it was back close to the holidays. Since than I have solve the problem and thought I would post it to help others with the same situation. I used the code within a HTML drop down menu form.
As it turn out, when searching for a RANGE of two fields I needed to clearly define the format for each fieldname and not rely on a “comma” to combine two fieldnames formats.
Below are the codes for this situation:
Wrong Way:
[/#ff0000]-------------------------------------------------------------------------------------------
<select name="dress_price" onChange="MM_jumpMenu('self',this,1)">
<option value="#" selected>Search By Price:</option>
<option value="myfilename.php?saleprice,[/#ff0000]price_min=100&saleprice,[/#ff0000]price_max=200">$100 to $200</option>
</select>
Right Way:[/#0080ff]
[/#ff0000]-------------------------------------------------------------------------------------------
<select name="dress_price" onChange="MM_jumpMenu('self',this,1)">
<option value="#" selected>Search By Price:</option>
<option value=" myfilename.php?saleprice_min,[/#0080ff]price_min=100&saleprice_max,[/#0080ff]price_max=200">$100 to $200</option>
</select>
Thanks
Re: [studio-a] Multi-Field Search Syntax?
By Dave - February 13, 2009
interactivetools.com