SolrParams::addParam

(PECL solr >= 0.9.2)

SolrParams::addParamAdds a parameter to the object

Descrierea

public SolrParams::addParam ( string $name , string $value ) : SolrParams

Adds a parameter to the object. This is used for parameters that can be specified multiple times.

Parametri

name

Name of parameter

value

Value of parameter

Valorile întoarse

Returns a SolrParam object on success and false on failure.

add a note add a note

User Contributed Notes 1 note

up
0
horaciod at gmail dot com
1 year ago
great for adding unintended parameters in other functions like facet.contains

?php
$facet = 'title'  ;
$str='isto';
$query = new SolrQuery($filter);
$query->setFacet(true)->setShowDebugInfo(true);

$query->addFacetField($facet)->setFacetMinCount(1)->setFacetLimit(200)->setfacetsort(SolrQuery::TERMS_SORT_INDEX);

$query->addparam('facet.contains',$str) ;

?>
// result of $query->getparams()  //check the lastone
array(8) {
  ["q"]=>  array(1) {
    [0]=>    string(20) "collection_id_str:61"
  }
  ["facet"]=>  array(1) {
    [0]=>    string(4) "true"
  }
  ["debugQuery"]=>  array(1) {
    [0]=>    string(4) "true"
  }
  ["facet.field"]=>  array(1) {
    [0]=>    string(11) "440a_str_mv"
  }
  ["facet.mincount"]=>  array(1) {
    [0]=>    string(1) "1"
  }
  ["facet.limit"]=>  array(1) {
    [0]=>    string(3) "200"
  }
  ["facet.sort"]=>  array(1) {
    [0]=>    string(5) "index"
  }
  ["facet.contains"]=>  array(1) {
    [0]=>    string(4) "isto"
  }
}
To Top