Get a Quote Today!   |   + 1 (301) 424 3903




 
  Community
 
Need Help?
Visit our Training page
Request a Quote or Consultation
SIGN UP FOR THE TERATECH NEWSLETTER
 

ColdCuts

Cut: Verity Keyword Disaster
Cut#: 122 
Cut Date: 03/14/2000 
Cutter: Eron Cohen 
Topic: Error Handling 
Overview:

I have a Verity search. When I use a keyword like 'and', 'or', 'near' my searching works fine. For example I want all basketball players like 'vince or carter' - no problem. But when keywords are entered multiple times - like 'vince and and carter' my application blows up and I get an error message.

1) Is there a way to trap the error message? 2) why doesn't Verity check for this?

 

Cut Code:
Verity is really bad a giving errors. This
particular one could be picked up with CFCATCH/CFTHROW and resubmitted with
the word removed, but its probably better to be proactive.

Hope this helps.

<!--- Form.search_for is your search field --->
<CFSET Original_Question = LCase(#form.search_for#)>


<CFSET #client.searchforthis# = #form.search_for#>
<CFSET Words_to_be_substituted = "or or, and and, not not">
<CFSET Words_to_be_substituted_with = "or, and, not">
<CFSET Punctuation = "?,!,.,:,'">
<CFSET HumanGarbage = "Fabio, stupid, with, about, also, card, problem,
question, health, sick, clever,
stupid,with,about,also,card,my,getting,get,have,having,are,do,make,create">

<CFLOOP LIST="#punctuation#" INDEX="This">
<CFSET Original_Question = Replace(Original_Question, This, "", "ALL")>
</CFLOOP>

<!--- GET RID OF ALL THE GARBAGE WORDS --->
<CFLOOP LIST="#HumanGarbage#" INDEX="This">
<CFLOOP CONDITION="ListFindNoCase(Original_Question, This, ' ') GREATER
THAN 0">
<CFSET FoundAt = ListFindNoCase(Original_Question, This, ' ')>
<CFSET Original_Question = ListDeleteAt(Original_Question, FoundAt, "
")>
</CFLOOP>
</CFLOOP>


<!--- Now replace your problem words and phrases with better ones --->
<CFSET ORIGINAL_QUESTION=ReplaceList(Original_Question,
Words_to_be_substituted, Words_to_be_substituted_with)>


<!--- DELIMIT WHATEVER'S LEFT WITH COMMAS --->
<CFSET Original_Question = ListChangeDelims(Original_Question, ",", " ")>

<!---- MAKE SURE WE HAVEN'T STRIPPED OUT ALL THE WORDS --->
<CFIF ListLen(Original_Question) is 0>
put up an error message here
</cfif>

Hand ORIGINAL_QUESTION to CFSEARCH...



<CFSET ORIGINAL_QUESTION=ReplaceList(Original_Question,
Words_to_be_substituted, Words_to_be_substituted_with)>


<!--- DELIMIT WHATEVER'S LEFT WITH COMMAS --->
<CFSET Original_Question = ListChangeDelims(Original_Question, ",", " ")>

<!---- MAKE SURE WE HAVEN'T STRIPPED OUT ALL THE WORDS --->
<CFIF ListLen(Original_Question) is 0>