PHP 8.6.0 Beta 1 is available for testing

SolrQuery::setExpand

(PECL solr >= 2.2.0)

SolrQuery::setExpandEnables/Disables the Expand Component

Description

public function SolrQuery::setExpand(bool $value): SolrQuery

Enables/Disables the Expand Component.

Parameters

value

Bool flag

Return Values

SolrQuery

Examples

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;
?>

The above example will output something similar to:

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

See Also

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /