Twitter: raymondcamden


Address: Lafayette, LA, USA

Solr presentation assets, and a note on DisMax searching

10-24-2013 3,649 views ColdFusion 5 Comments

Attached to this blog entry is the zip of my slides and demos from my Solr presentation at the CF Summit.

During my preparation for this presentation, I did some research into DisMax type searching. This is a Solr search type that you can use by simply adding it to your cfsearch tag.


>cfsearch collection="myblog" criteria="#form.search#" name="results" 
	status="searchStatus" suggestions="always" 
	type="dismax" 
&lgt;

Why would you use it versus the standard type? From the Wiki

Simply put, it's your choice for all user generated queries.

Out of the box, Solr uses the standard Solr query parser which is pretty stupid, understanding only syntactically correct boolean queries like "title:foo OR body:foo", it can only search one field by default, and it may very well throw an exception in your face if you put in some characters it does not like.

Therefore a new, more robust query mode was needed and the DisMax and ExtendedDisMax Query Parsers were born. They are designed to process simple user entered phrases (without heavy syntax) and search for the individual words across several fields using different weighting (boosts) based on the significance of each field, and it should never throw an exception.

All in all, it sounds like there is no reason you shouldn't switch to using it. However, when I first tested it, it seemed broken. I even filed a bug report on it. But during my presentation, I discovered I had screwed up my code and the feature works perfectly fine.

As a simple example, consider a search for "phonegap coldfusion" on this blog. By default, the standard search treats this as "OR" and returns over 2000 results. With DismMax it treats it as AND and you get far fewer, but probably much more relevant, results.

I'm going to update my own blog engine when I get back next week and I'm sure there are reasons why you wouldn't always use DisMax, but to me, it seems pretty clear that you probably want to test it out.

Download attached file

5 Comments

  • Commented on 10-25-2013 at 12:04 PM
    Great session Ray on Solr @ CF Summit
  • Commented on 10-25-2013 at 12:05 PM
    Thank you.
  • Commented on 10-25-2013 at 12:17 PM
    FYI, this site is using DisMax now.
  • Ritesh Upadhyay #
    Commented on 01-04-2014 at 3:15 AM
    How can i implimented dismaxparse in php+solr guide me
  • Commented on 01-04-2014 at 8:27 AM
    I don't use PHP. The presentation described here is entirely about Solr and ColdFusion.

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty