PHP 8.4.0 RC2 available for testing

SolrQuery::setExpand

(PECL solr >= 2.2.0)

SolrQuery::setExpandAtiva/desativa o componente de expansão

Descrição

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

Ativa/desativa o componente de expansão.

Parâmetros

value

Valor booleano.

Valor Retornado

SolrQuery

Exemplos

Exemplo #1 Exemplo de SolrQuery::setExpand()

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

?>

O exemplo acima produzirá algo semelhante a:

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

Veja Também

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top