SolrDisMaxQuery::removeBoostQuery

(No version information available, might only be in Git)
Removes a boost query partial by field name (bq)
public SolrDisMaxQuery SolrDisMaxQuery::removeBoostQuery ( string $field )

Removes a boost query partial from the existing query, only if SolrDisMaxQuery::addBoostQuery() was used.

Parameters:
field

Field Name

Returns:

SolrDisMaxQuery

Examples:
SolrDisMaxQuery::removeBoostQuery() example
<?php

$dismaxQuery = new SolrDisMaxQuery("lucene");
$dismaxQuery
    ->addBoostQuery('cat', 'electronics', 5.1)
    ->addBoostQuery('cat', 'hard drive')
;
echo $dismaxQuery.PHP_EOL;
// now remove a query part with field 'cat'
$dismaxQuery
->removeBoostQuery('cat');
echo $dismaxQuery . PHP_EOL;

?>

The above example will output something similar to:

q=lucene&defType=edismax&bq=cat:electronics^5.1 cat:hard drive
q=lucene&defType=edismax&bq=cat:hard drive
See also:

SolrDisMaxQuery::addBoostQuery() -

SolrDisMaxQuery::setBoostQuery() -

doc_php
2016-02-24 16:11:45
Comments
Leave a Comment

Please login to continue.