2 Replies Latest reply on Jan 25, 2007 6:24 AM by pr_coldfusion

    verity search

      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.

      <cfsearch name="GetResults"
        • 1. Re: verity search
          Fernis Level 3
          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)>

          ...and then, in the criteria attribute of the cfsearch, wrap the FORM.keywords with the optional quotation marks. Like this:

          Everything above is purely theoretical, I haven't tried any of that in practice. Hope this helps anyway.
          • 2. Re: verity search
            pr_coldfusion Level 1
            Thanks! I have tried that. Somehow enclosing in quotes is not working.