Skip to main content
Participating Frequently
August 9, 2011
Question

Key Word Search

  • August 9, 2011
  • 2 replies
  • 536 views

I need a way to search a particular field for "keywords" that may have been entered by a user in a search field.

Example:     Keywords:  phone,cable,contract   OR    Keywords:  phone,cable    OR Keywords:  contract

I'm looking for a way to search for above  keywords within lets say a Description field.  The # of keywords entered is up to the user based on the types things they are looking for.

Any ideas?

Thanks in advance.

Brian

    This topic has been closed for replies.

    2 replies

    Inspiring
    August 9, 2011

    select somefields

    from sometables

    where 1 = 2

    <cfloop list="#keywords#" index = "word">

    or somefield like '%#word#%'

    </cfloop>

    Known Participant
    August 9, 2011

    are you looking for an autocomplete function while using a search engine or to you want to search the posted form data on the server?

    bbagwellAuthor
    Participating Frequently
    August 9, 2011

    I just need to search a single field within a table.   Something like:

    select * from contract where the keywords entered are within the Description field

    Known Participant
    August 9, 2011

    You need to be explain more. SELECT * FROM indicates that you want to do a SQL query?

    e.g

    SELECT * FROM dbo,xx

    WHERE Description = 'keyword1' OR Description = 'keyword2' ...