SolrQuery::setExpand
PHP function
Edit on GitHub ✎
(PECL solr >= 2.2.0)
Enables/Disables the Expand Component
Description
SolrQuery::setExpand(bool $value): SolrQuery
Enables/Disables the Expand Component.
Parameters
valueBool flag
Return Values
SolrQuery
Examples
SolrQuery::setExpand() example
php
<?php
$query = new SolrQuery('lucene');
$query
->setExpand(true)
->setExpandRows(50)
->setExpandQuery('text:product')
->addExpandFilterQuery('manu:apple')
->addExpandFilterQuery('inStock:true')
->addExpandSortField('score', SolrQuery::ORDER_DESC)
->addExpandSortField('title', SolrQuery::ORDER_ASC);
echo $query.PHP_EOL;
?>The above example will output something similar to:
output
q=lucene&expand=true&expand.rows=50&expand.q=text:product&expand.fq=manu:apple&expand.fq=inStock:true&expand.sort=score desc,title ascSee Also
SolrQuery::addExpandSortFieldSolrQuery::removeExpandSortFieldSolrQuery::setExpandRowsSolrQuery::setExpandQuerySolrQuery::addExpandFilterQuerySolrQuery::removeExpandFilterQuery