SolrQuery::setExpand

(PECL solr >= 2.2.0)
Enables/Disables the Expand Component
public SolrQuery SolrQuery::setExpand ( bool $value )

Enables/Disables the Expand Component.

Parameters:
value

Bool flag

Returns:

SolrQuery

Examples:
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:

SolrQuery::addExpandSortField() -

SolrQuery::removeExpandSortField() -

SolrQuery::setExpandRows() -

SolrQuery::setExpandQuery() -

SolrQuery::addExpandFilterQuery() -

SolrQuery::removeExpandFilterQuery() -

doc_php
2016-02-24 16:11:29
Comments
Leave a Comment

Please login to continue.