downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SolrQuery::removeStatsFacet> <SolrQuery::removeMltQueryField
[edit] Last updated: Fri, 17 May 2013

view this page in

SolrQuery::removeSortField

(PECL solr >= 0.9.2)

SolrQuery::removeSortFieldRemoves one of the sort fields

Описание

public SolrQuery SolrQuery::removeSortField ( string $field )

Removes one of the sort fields

Список параметров

field

The name of the field

Возвращаемые значения

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



add a note add a note User Contributed Notes SolrQuery::removeSortField - [1 notes]
up
0
hasbridge at gmail dot com
2 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:

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

 
show source | credits | stats | sitemap | contact | advertising | mirror sites