SolrQuery::setExpand()
(PECL solr >= 2.2.0)
Enables/Disables the Expand Component
说明
public SolrQuery::setExpand(bool $value): SolrQuery
Enables/Disables the Expand Component.
参数
- $value
Bool flag
返回值
SolrQuery
范例
Example #1 SolrQuery::setExpand() example
<?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; ?>
以上例程的输出类似于:
q=lucene&expand=true&expand.rows=50&expand.q=text:product&expand.fq=manu:apple&expand.fq=inStock:true&expand.sort=score desc,title asc
参见
- SolrQuery::addExpandSortField() Orders the documents within the expanded groups(expand.sort parameter)
- SolrQuery::removeExpandSortField() Removes an expand sort field from the expand.sort parameter
- SolrQuery::setExpandRows() Sets the number of rows to display in each group(expand.rows). Server Default 5
- SolrQuery::setExpandQuery() Sets the expand.q parameter
- SolrQuery::addExpandFilterQuery() Overrides main filter query, determines which documents to include in the main group
- SolrQuery::removeExpandFilterQuery() Removes an expand filter query