SolrQuery::removeSortField

(PECL solr >= 0.9.2)

SolrQuery::removeSortFieldRemoves one of the sort fields

Description

public SolrQuery SolrQuery::removeSortField ( string $field )

Removes one of the sort fields

Parameters

field

The name of the field

Return Values

Returns the current SolrQuery object, if the return value is used.

Коментарии

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:

<?php
$object
->removeSortField('fieldName asc');
?>

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

<?php
$fieldName 
trim(str_replace(array('asc''desc')), ''$fieldName);
?>
2010-07-23 17:16:35
http://php5.kiev.ua/manual/ru/solrquery.removesortfield.html

    Поддержать сайт на родительском проекте КГБ