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

I've been experimenting with the new search parameters in CMS Builder. I can search for any single field and get matching records using this:

<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!
Darren Hester
www.designsbydarren.com

Re: [DHester] Multi-Field Search Syntax?

By Dave - January 19, 2008

Hi Darren,

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.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-Field Search Syntax?

By DHester - January 20, 2008

Thanks, that did the trick! I'm really enjoying CMSB. You did a great job. I've used a lot of other content management/blogging scripts including snews, wordpress, and expression engine. CMSB is quickly becoming my favorite [;)]

I appreciate all your help!
Darren Hester
www.designsbydarren.com

Re: [studio-a] Multi-Field Search Syntax?

By Dave - December 8, 2008

Hi Studio-a,

I want to do a little more research on this one. I'll get back to you shortly. Stay tuned. :)
Dave Edis - Senior Developer
interactivetools.com

Re: [studio-a] Multi-Field Search Syntax?

By Dave - December 9, 2008

Hi Studio-a,

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!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-Field Search Syntax?

Hi Dave,

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

Hi studio-a,

Feel free to email me the ticket number to dave@interactivetools.com and I can take a closer look.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-Field Search Syntax?

Hi Dave,

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

Glad to hear you got it working! Thanks for posting back with your working code! :)
Dave Edis - Senior Developer
interactivetools.com