close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Search question - comma separated words?

Thread began 4/06/2012 12:23 pm by iainmacdonald331081 | Last modified 4/11/2012 2:06 pm by iainmacdonald331081 | 889 views | 9 replies |

iainmacdonald331081

Search question - comma separated words?

I've added a search form to a site here:

search/

I just wanted to check if its possible to search for any words in a search string?

For example, there's a school called 'Driving with Debbie', which is returned correctly if you search for 'Driving with Debbie'.

But should it be possible to find her using just the words 'driving' and 'debbie'? It doesn't currently, at least not with 'driving, debbie'. I couldn't remember if it should be possible, and I've missed something somewhere.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

depends on how you configured the search criteria in the data assist wizard.


the criteria for a column can be configured using the "=", "begins with", "includes", or "ends with" comparison.

if you set the comparison to "=", it will only find the school if you enter the full name.

It also depends on the filter type you use.

it sounds to me like you have the criteria set to use the "=" comparison and the value filter type. this will convert the search string:
'driving, debbie'

to:
WHERE school = 'driving, debbie'

if you select the keyword filter type, you can set an AND separator and an OR separator.

from your description of how you want the search to work, you should be using the "Includes" comparison, the keyword filter type and you should set the OR separator to ", " (thats a comma followed by a space). this will convert the search string:
'driving, debbie'

to:
WHERE school LIKE '%driving%' OR school LIKE '%debbie%'

to give the desired results.

Sign in to reply to this post

iainmacdonald331081

Thanks Jason.

I've attached a screen shot showing a couple of screens from the Server Behaviour Configuration. What do I need to change exactly? In the right hand image, I found the Keyword filter OK - changing type from Edit to Keyword?

But I wasn't sure about the separator - I tried changing the OR in the OR box to a comma, but that started returning all schools regardless of what I entered.

I'm sure this is simple, but if you could look at the screenshot and let k=me know exactly what needs to go where that would be great.

Attached Files
database_search.zip
Sign in to reply to this post

Jason ByrnesWebAssist

yes, change the type from edit to keyword


for the OR separator, use a comma followed by a space.

Sign in to reply to this post

iainmacdonald331081

I'm not getting this Jason - I've changed it to Keyword, and changed the OR to a , but now when I search using the School field, its returning every record for any search.

Just to let you know I spotted where it was going wrong - when I changed the search criteria, the //comparison list additions lines of code were using $_POST instead of $_GET - I changed those and it was all OK.

Sign in to reply to this post

iainmacdonald331081

Can you do me a quick favour though - can you try a few searches for towns from the home page?

As far as I can tell, its all OK, but my client is saying he sometimes gets random, incorrect results. He has most recently said its when he just hits rerun, rather than the search button, but I wouldn't have thought that should make any difference.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

this is an issue with IE and image input elements when used as the trigger.

an image element type doers not send a value when submitted, it send x and y coordinates of where the mouse clicked it.

using the enter key bypasses this so that the x and y coordinates are empty.

to work around this, add a hidden form element named "Search_x" to the search form and give it any value.

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - I added that here :

www.learners-guide.co.uk

Apparently it's OK when the search button is hit, but not when you hit enter.

Can you have a look and check I've made the correct change?

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

the hidden element does not have a value, you need to give the element a value.

Sign in to reply to this post

iainmacdonald331081

Thanks Jason - that's all fine now.

I'd used CSS on the contact form:

.searchbutton {
background-color:#FFF;
background-image:url(../images/search2.jpg);
background-repeat:no-repeat;
width:85px;
height:24px;
border:0px;
}
.searchbutton:hover {
background-image:url(../images/search1.jpg);
background-repeat:no-repeat;
}

But the search didn't like that, so had gone back to the image type.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...