略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SolrQuery::setExpand

2024-12-22

SolrQuery::setExpand

(PECL solr >= 2.2.0)

SolrQuery::setExpandEnables/Disables the Expand Component

说明

public 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

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/solrquery.setexpand.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3