Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Searching for keywords

Engaged ,
Jun 10, 2008 Jun 10, 2008
Hi everyone,
I was wondering if there was a way I could find some text that is separated by a word in the middle? For example, if I search for GHz Socket on our web site, our part numbers don’t show up because the column this search is querying off of has, “GHz BGA Socket” in it. Is there a way so that the user does not have to type the exact thing or groups of words together all together when they type the words in? I would like it so they don’t have to type BGA in order to see these parts. I’m trying to use the % signs which I thought you could type anything anywhere and still come up with results since it would have some of thee words in the search. The way I have the code right now is like this:



<cfif PartNumber NEQ "*">

<cfset session.BrowsePartGridWhere = "Part_Description LIKE '%#PartNumber#%'">

</cfif>

Thanks.

Andy Text
TOPICS
Getting started
483
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 10, 2008 Jun 10, 2008
Try searching for GHz%Socket if Part_Description LIKE '%#PartNumber#%'

Phil
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 10, 2008 Jun 10, 2008
This only works if the user actually types in "ghz%socket" into the search form. They're not going to know to do that though. I would like to write this into the code somehow to catch things like this. Do you have any other ideas? Thanks.

Andy
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2008 Jun 10, 2008
jamie61880 wrote:
> This only works if the user actually types in "ghz%socket" into the search
> form. They're not going to know to do that though. I would like to write this
> into the code somehow to catch things like this. Do you have any other ideas?
> Thanks.
>
> Andy
>

Do that programmatically. I.E. it would be a fairly simple string
operation to replace all the spaces in a search string with the %
character. Then the user types "ghz socket" but the database receives
"ghz%socket".

There are performance considerations to this, but it is not complex to
implement if it works for you.

If you want a more robust solution you are looking to implement some
type of natural language searching. Verity, bundled with CF, provides
some of this type of functionality. Many of the more complex database
managements systems also provide some type of natural language search
features. You will have to dig into this if you choose this path.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 11, 2008 Jun 11, 2008
LATEST
this is slow but it works

where (
lower(yourfield) like '%#lcase(word1)#%'
or
lower(yourfield) like '%#lcase(word2)#%'
etc

)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources