PHP 8.4.0 RC2 available for testing

SolrQuery::removeSortField

(PECL solr >= 0.9.2)

SolrQuery::removeSortFieldSupprime un champ de tri

Description

public SolrQuery::removeSortField(string $field): SolrQuery

Supprime un champ de tri

Liste de paramètres

field

Le nom du champ.

Valeurs de retour

Retourne l'objet SolrQuery courant, si la valeur retournée est utilisée.

add a note

User Contributed Notes 1 note

up
0
hasbridge at gmail dot com
14 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);
?>
To Top