« SolrQuery::setEchoParams
SolrQuery::setExpandQuery »

SolrQuery::setExpand

(PECL solr >= 2.2.0)

SolrQuery::setExpand — Enables/Disables the Expand Component

説明

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

Enables/Disables the Expand Component.

パラメータ

value

Bool flag

戻り値

SolrQuery

例

例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   expand   setExpand   query   Enables   Disables   Expand   Component   sort   setExpandQuery   addExpandFilterQuery   addExpandSortField   rows   parameter   lucene   setExpandRows   text   product   manu   apple   inStock   score   title   documents   Removes
関連する関数・ページ:
solrquery.setexpandquery   solrquery.removeexpandfilterquery   solrquery.removeexpandsortfield   solrquery.setexpandrows   solrquery.getexpandquery   solrquery.addexpandsortfield