O'Reilly logo

Apache Solr PHP Integration by Jayant Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Executing queries using DisMax and eDisMax

Let us explore how to execute DisMax and eDisMax queries using the Solarium library. First, get a DisMax component from our select query using the following code:

$dismax = $query->getDisMax();

Boosting is used in Solr to alter the score of some documents in a resultset, so that certain documents are ranked higher than others based on their content. A boost query is a raw query string that is inserted along with the user's query to boost certain documents in the result. We can set a boost on author = martin. This query will boost results where author contains martin by 2.

$dismax->setBoostQuery('author:martin^2');

Query fields specify the fields to query with certain boosts. The query string passed in setQuery ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required