Mid-Atlantic Developer Conference - Call for Speakers


(PECL solr >= 0.9.2)

SolrQuery::removeSortFieldحذف یکی از فیلدهای مرتب‌سازی


publicSolrQuery SolrQuery::removeSortField ( string $field )

حذف یکی از فیلدهای مرتب‌سازی



نام فیلد

Return Values

بازگرداندن شی فعلی SolrQuery اگر مقدار بازگشت استفاده شده باشد.

add a note add a note

User Contributed Notes 1 note

hasbridge at gmail dot com
7 years ago
This method will generate a notice if you try and remove a sort field that isn't set. This can happen if you call getSortFields, which will return an array like:

[0] => 'fieldName asc',
[1] => 'fieldName desc

But if you try and call:

->removeSortField('fieldName asc');

You will get a notice. Instead, you need to truncate the sort order (' asc', ' desc') part of it. Something like:

= trim(str_replace(array('asc', 'desc')), '', $fieldName);
To Top