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

Need a quote on creating a site search engine cfc

LEGEND ,
Jul 25, 2006 Jul 25, 2006

Copy link to clipboard

Copied

Ok, this is what I have set up and you get the idea on what I am trying to
accomplish.

I have a table of my database called 'members'

Amongst other items I have columns called:

state: varchar(2)
service: TinyInt
keywords: LongText

When people sign up they choose their service from a list, choose their
state from a list and enter keywords from a textbox which is all inserted
into the table. They can enter it any way they want.

When people go to search, they have to choose a state and a service
(required).
The keywords is optional and is a textbox. They may just put
random words in there or separate them with comma or such.

I need a SQL code written that will take the state and the service which are
always chosen and add the option of keywords.

I would like this put into a CFC to use on the site.

How much would anyone / everyone charge me to do this for me? I am at my
wits end and don't have the time to keep this request up.

I will probably learn better from seeing it completed then to have people
send me to places.

If you need any other information, please ask.

Listed below is that I have currently. Everything works fine except for the
keywords section. It works if one word is entered, but bombs if you enter
more than one.

<cfcomponent>
<cffunction name="ServiceSearch" access="remote" returntype="query">
<cfargument name="service" type="string" required="true">
<cfargument name="state" type="string" required="true">
<cfargument name="keywords" type="string" required="false">
<cfquery name="ServiceResults" datasource="#Request.MainDSN#">
Select company, name, phone, service, city, state, username FROM members
WHERE service = #arguments.service# AND state = '#arguments.state#'
<cfif len(trim(arguments.keywords)) GT 0>
AND keywords LIKE '%#Trim(arguments.keywords)#%'
</cfif>
ORDER BY company ASC
</cfquery>
<cfreturn ServiceResults>
</cffunction>
</cfcomponent>

Please let me know.

--
Wally Kolcz
Developer / Support


TOPICS
Advanced techniques

Views

219

Translate

Translate

Report

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
Participant ,
Jul 25, 2006 Jul 25, 2006

Copy link to clipboard

Copied

you would have to tell the users to separate the entered keywords by comma or space. Then you would take that list and delimit it into a array. This can then be feed to your query like this................

<cfset searchlogic2 = ListAppend(searchlogic2,'AND Title like "#First Item of Array#%"',' ')>
You would have to loop over your array to append all of the keywords to the searchlogic2 string.
Then you just use that sting in your query.....................
<cfquery name="GetActivity" datasource="WEARS">
SELECT *
WHERE ________
#searchlogic2#
</cfquery>

Hopefully that helps!

Votes

Translate

Translate

Report

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 ,
Jul 27, 2006 Jul 27, 2006

Copy link to clipboard

Copied

LATEST
I need a developer to give me a price to create this for me.


Votes

Translate

Translate

Report

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
Documentation