Skip to main content
Inspiring
August 10, 2011
Question

Verity search functions in Cold Fusion

  • August 10, 2011
  • 1 reply
  • 1709 views

I am implementing a Verity search function within a Cold Fusion 9.0.1 application. The clients want it to "work like Google". One problem they have identified is how Verity handles multiple words entered without any type of operators. I can't seem to get Verity to treat it as an AND search, it executes an OR search.

In all my examples below, the search strings are set in BOLD.

If I go to Google and enter Philippines transport, I get the same number of results as if I entered Philippines AND transport. If I change the string to Philippines OR transport I get a much larger number of results. Obviously, Google is performing an AND search by default, i.e. finding all records that have *both* words.

In my app, if I enter Philippines transport I get the same number of results as I do if I enter  Philippines OR transport. The only way I can get Verity to return only those records that have *both* words is to explicitly enter Philippines AND transport.

Any suggestions?

Thanks in advance!

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 10, 2011

    First. if you're just creating this now, don't use Verity.  It's dead technology, and it's going to be removed from CF in the next version.  Use Solr instead.

    Second: read the docs.  All of this is covered in there:

    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS2B335964-A0DA-4add-B9FE-4041464EC9E1.html

    There's a section on the search syntax in there.  Give it a read & if you can't find what you need in there.  If it's not in the CF-specific docs, maybe look @ the actual Solr docs:

    http://lucene.apache.org/solr/

    --

    Adam

    mkane1Author
    Inspiring
    August 10, 2011

    Adam, I have read the docs. But perhaps not accurately. I created a Solr version of my collection, and the default behavior in my new app is exactly the same: Entering Philippines transport does an OR search.

    The "Migrating from Verity to Solr " part of the Adobe docs suggests  that I have to reformat the search string provided.

    If I do that, so that the search string is passed as +Philippines +transport, it results in the desired AND search.

    That doesn't seem practical at all. What if they enter Philippines transport OR fred ? Looking at the "Solr search examples" part of the Adobe docs suggests I would have to create complicated rules to properly deal with the search string. That's crazy!

    Inspiring
    August 10, 2011

    You probably need to approach it from the POV of what the user types in is not necessarily what you end up passing to CFSEARCH.  You could perhaps strip out all words that are significant to Solr's search syntax, (eg: OR), and then prefix all words with + (if you want an AND search all the time).  You will need to do some sort of massaging of the user input, but it'll be possible for a user to input a string which'll be syntactically invalid to Solr, and cause CFSEARCH to error.

    That said, what happens if you use type=internet on the CFSEARCH tag?

    --
    Adam