Solr presentation assets, and a note on DisMax searching

This post is more than 2 years old.

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="" name="results" 
	status="searchStatus" suggestions="always" 

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.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by Kevin Jones posted on 10/25/2013 at 9:04 PM

Great session Ray on Solr @ CF Summit

Comment 2 by Raymond Camden posted on 10/25/2013 at 9:05 PM

Thank you.

Comment 3 by Raymond Camden posted on 10/25/2013 at 9:17 PM

FYI, this site is using DisMax now.

Comment 4 by Ritesh Upadhyay posted on 1/4/2014 at 2:15 PM

How can i implimented dismaxparse in php+solr guide me

Comment 5 by Raymond Camden posted on 1/4/2014 at 7:27 PM

I don't use PHP. The presentation described here is entirely about Solr and ColdFusion.