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

SolrDisMaxQuery::addQueryField

PHP function Edit on GitHub ✎

Add a query field with optional boost (qf parameter)

Description

SolrDisMaxQuery::addQueryField(string $field, [string $boost]): SolrDisMaxQuery

Add a query field with optional boost (qf parameter)

Parameters

field

field name

boost

Boost value. Boosts documents with matching terms.

Return Values

SolrDisMaxQuery

Examples

SolrDisMaxQuery::addQueryField() example

php
<?php

$dismaxQuery = new SolrDisMaxQuery("lucene");
$dismaxQuery
    ->addQueryField("location", 4)
    ->addQueryField("price")
    ->addQueryField("sku")
    ->addQueryField("title",3.4)
;
echo $dismaxQuery;

?>

The above example will output something similar to:

output
q=lucene&defType=edismax&qf=location^4 price sku title^3.4

See Also

  • SolrDisMaxQuery::removeQueryField

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