Using the ExtendedDisMax query parser

The ExtendedDisMax Query Parser (eDisMax) includes more features than the traditional Solr query parser, such as multi-field query (Disjunction Max Query), relevancy calculations, full query syntax, and aliasing.

The traditional Solr query parser (defType=lucene) is the default query parser and intended for compatibility with traditional Solr queries. The ExtendedDisMax Query Parser (eDisMax) includes more features than than the traditional Solr query parser, such as multi-field query (Disjunction Max Query), relevancy calculations, full query syntax, and aliasing. eDisMax is essentially a combination of the traditional Solr query parser and the dismax query parser, plus a number of other functional and usability enhancements.

eDisMax supports phrase query features, such as phrase fields and phrase slop. You can use full query syntax to search multiple fields transparently, eliminating the need for inefficient copyField directives.

Note: To use Solr Extended DisMax Query Parser (eDisMax) with solr_query, you must include defaultSearchField in your schema.

eDisMax example using the cqlsh

Configure the solrconfig to handle CQL queries if necessary. To query the mykeyspace.mysolr table from collection set example, use local query parameters to specify using eDisMax, and query the default field for either of two words: yearning or kills:
SELECT * FROM mykeyspace.mysolr WHERE solr_query='{"q" : "{!edismax}quotes:yearning or kills"}';

Output is the one row containing "yearning," and the another containing "kills".

 id  | name               | quotes                                                     | solr_query | title
-----+--------------------+---------------------------------------------------------------------------------
 123 | Christopher Morley | {'Life is a foreign language . . . earning and yearning.'} |       null |  Life
 124 |        Daniel Akst | {'In matters of self-control . . . speed kills . . . '}    |       null |  Life

(2 rows)

eDisMax example using the Solr HTTP API

To query the mykeyspace.mysolr table from collection set example, use the deftype parameter to specify using eDisMax, and query the default field for either of two words: yearning or kills:
http://localhost:8983/solr/mykeyspace.mysolr/
      select?&defType=edismax&q=yearning or kills
      &wt=json&indent=on&omitHeader=on
Output in json format is:
{
     "response":{"numFound":2,"start":0,"docs":[
         {
           "id":"123",
           "title":"Life",
           "quotes":["Life is a foreign language; all men mispronounce it.",
           "There are three ingredients in the good life: learning, earning and yearning."],
           "name":"Christopher Morley"
         },
         {
           "id":"124",
           "title":"Life",
           "quotes":["In matters of self-control as we shall see again and again, speed kills.
            But a little friction really can save lives.", "We Have Met the Enemy: 
            Self-Control in an Age of Excess."],
           "name":"Daniel Akst"}]
         }
   }