Skip to main content
Participant
December 8, 2011
Answered

verity cfsearch format question

  • December 8, 2011
  • 1 reply
  • 970 views

Hi there,

I am having difficulty implementing logic into my cfsearch query. Basically if the user inputs "petrol gas" in the search box I want the query to return pages from my index which have petrol AND gas in the desciption field. I am having no issues with searching one word searches or anything like that, preventing stemming etc, its just the operator stuff I can't get to work whatever I try.

For example if I run the following <cfsearch collection="de_verity" name="results" maxrows="1000" criteria="petrol AND gas" type="explicit"> it doesn't work (ie. the results aren't correct).

If i try <cfsearch collection="de_verity" name="results" maxrows="1000" criteria="<AND>petrol gas" type="explicit"> it throws an error. I will also want to OR some data but I'm assuming if I can crack the AND issue the OR issue will be exactly the same.

Anyone have any running implementations including some logical operators. We're running coldfusion 7 which is old I know.

Thanks

    This topic has been closed for replies.
    Correct answer theroversreturn4

    Well, I'm out of ideas then! I haven't worked with Verity in a long time, and that was the only thing that seemed a likely candidate to me.

    You might try running commands directly against Verity, rather than using CFSEARCH, to see how they behave. You can do that with the k2 command-line tools, if I recall correctly. Again, though, it's been many years since I've done that too, so those tools may not even be present on current versions of CF I guess.

    Dave Watts, CTO, Fig Leaf Software


    think I might have it.

    this seems to work <cfsearch collection="de_verity" name="results" maxrows="1000" criteria="'petrol' AND 'gas'" type="explicit">

    1 reply

    Community Expert
    December 8, 2011

    Have you tried escaping the angle brackets in your criteria value?

    Dave Watts, CTO, Fig Leaf Software

    Dave Watts, Eidolon LLC
    Participant
    December 8, 2011

    Hi Dave,

    Do you mean <cfsearch collection="de_verity" name="results" maxrows="1000" criteria="\<AND\>petrol gas" type="explicit"> ?

    I don't think I need to escape those characters. From what I can see from the docs it says if you want to use logical operators you preceed the search_string with the operator in question.

    According to the docs:-

         Ordinarily, you use operators in explicit searches, as follows:

    "<operator>search_string"  
    Community Expert
    December 8, 2011

    I mean that you can't include angle brackets as literal characters within CFML tag attribute values. CF doesn't use backslashes to escape, either. I'd guess you have to use the appropriate HTML character entities instead, but haven't tested this:

    <cfsearch ... criteria="&lt;AND&gt; petrol gas" ...>

    Dave Watts, CTO, Fig Leaf Software

    Dave Watts, Eidolon LLC