php8.5
Home/ Manual/ solr / solrdismaxquery/ SolrDisMaxQuery::removeQueryField

SolrDisMaxQuery::removeQueryField

PHP function Edit on GitHub ✎

Removes a Query Field (qf parameter)

Description

SolrDisMaxQuery::removeQueryField(string $field): SolrDisMaxQuery

Removes a Query Field (qf parameter) from the field list added by SolrDisMaxQuery::addQueryField

qf: When building DisjunctionMaxQueries from the user's query it specifies the fields to search in, and boosts for those fields.

Parameters

field

Field Name

Return Values

SolrDisMaxQuery

Examples

SolrDisMaxQuery::removeQueryField() example

php
<?php

$dismaxQuery = new SolrDisMaxQuery('lucene');
$dismaxQuery
    ->addQueryField('first', 3)
    ->addQueryField('second', 0.2)
    ->addQueryField('cat');
echo $dismaxQuery . PHP_EOL;
// remove field 'second'
echo $dismaxQuery->removeQueryField('second');
?>

The above example will output something similar to:

output
q=lucene&defType=edismax&qf=first^3 second^0.2 cat
q=lucene&defType=edismax&qf=first^3 cat

See Also

  • SolrDisMaxQuery::addQueryField

Source: reference/solr/solrdismaxquery/removequeryfield.xml · from the official PHP manual (php/doc-en)