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

verity search

New Here ,
Jan 24, 2007 Jan 24, 2007

Copy link to clipboard

Copied

How can I search a phrase using cfsearch?
The code I have below will search for any word. But I would like to search phrases also.
Is it possible. Can some one please share your thoughts.

Thanks!
<cfsearch name="GetResults"
collection="#collectionName#"
type="simple"
criteria="<WILDCARD>*#LCase(FORM.keywords)#*"
ContextPassages="1"
ContextBytes="500"
>
TOPICS
Advanced techniques

Views

319

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
Enthusiast ,
Jan 24, 2007 Jan 24, 2007

Copy link to clipboard

Copied

Let's assume I got this right, and understood from what I read in the ColdFusion documentation. Phrases can be searched by surrounding them with double quotes. Right? Consult CF or Verity documentation or goog... your nearest web search engine for more information on the subject.

If the above is true, let's continue...

You might have, say, a radiobutton option in your search form, like: search for ( ) words (o) phrases. Like:
<input type="radio" name="searchType" value="words"> words
<input type="radio" name="searchType" value="phrases"> phrases

Then a you could do this with the <cfsearch> tag:
<cfparam name="cqm" value=""> <!--- conditional quotation mark --->
<cfif FORM.searchType EQ "phrases">
<cfset cqm = chr(34)>
</cfif>

...and then, in the criteria attribute of the cfsearch, wrap the FORM.keywords with the optional quotation marks. Like this:
criteria="<WILDCARD>*#cqm##LCase(FORM.keywords)##cqm#*"

Everything above is purely theoretical, I haven't tried any of that in practice. Hope this helps anyway.

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
New Here ,
Jan 25, 2007 Jan 25, 2007

Copy link to clipboard

Copied

LATEST
Thanks! I have tried that. Somehow enclosing in quotes is not working.

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