$smwg­QSort­Features

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgQSortFeatures
Description Sets the behaviour for the sorting features of the semantic search
Default setting See below
Software Semantic MediaWiki
Since version
Until version still available
Configuration Query settings
Keyword query · sorting · semantic search


$smwgQSortFeatures is a configuration parameter that sets behaviour for the sorting features of the semantic search. The configuration parameter was introduced in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.1 and deprecated the configuration parameters as indicated in the section on available options below.

Starting with Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. this parameter accepts an array of plain string keys instead of the SMW_QSORT* constants. The constant form still works but is deprecated and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki..2

Default setting[edit]

$smwgQSortFeatures = [ 'sort', 'random' ];

This means that the two respective features, as explained in the following sections on available options, are enabled.

Available options[edit]

The options enabled by default are highlighted bold.
  • 'sort' (formerly SMW_QSORT) – Sets that sorting of query results is possible
NoteNote: This option replaces configuration parameter $smwgQSortingSupportSets whether sorting of query results should be possible.
  • 'random' (formerly SMW_QSORT_RANDOM) – Sets that random sorting of query results is possible
NoteNote: This option replaces configuration parameter $smwgQRandSortingSupportSets whether random sorting of query results should be possible.
  • 'unconditional' (formerly SMW_QSORT_UNCONDITIONAL) – Sets that sorting by a property will work unconditionally even if the respective property was not set to all pages selected, i.e. all pages will be shown3
NoteNote: This option is currently considered experimental and not available to SPARQLStore stores and SMWElasticStore store.
For further information on the available options listed above see the documentation pages of the respective deprecated configuration parameters as stated above.

Changing the default setting[edit]

To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file:

Removing a specific query sorting feature

To disable a specific feature e.g. random sorting of query results just redefine the configuration parameter without the corresponding string as shown in the above section on available options:

$smwgQSortFeatures = [ 'sort' ];
Adding a specific query sorting feature

To add a specific feature e.g. unconditional sorting of query results just redefine the configuration parameter including the corresponding string as shown in the above section on available options:

$smwgQSortFeatures = [ 'sort', 'random', 'unconditional' ];
Disabling all query sorting features

To disable all sorting features set an empty array:

$smwgQSortFeatures = [];

Legacy constant form (deprecated since 7.0.0)[edit]

The constant form below is deprecated since Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.. Use the string-array form shown above instead. It is documented here for wikis still running the constant form.

The default expressed with constants:

$smwgQSortFeatures = SMW_QSORT | SMW_QSORT_RANDOM;

A specific feature can be removed with a bit-operation, e.g.:

$smwgQSortFeatures = ( $smwgQSortFeatures & ~SMW_QSORT_RANDOM );
NoteNote: Please use parentheses4 when combining different bit-operations to avoid a possible mismatch.

To disable all sorting features with the constant form, use SMW_QSORT_NONE:

$smwgQSortFeatures = SMW_QSORT_NONE;

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:2821
  2. ^  | | | | | | | | |  Semantic MediaWiki: GitHub pull request gh:smw:6793
  3. ^  Semantic MediaWiki: GitHub pull request gh:smw:2823
  4. ^  Bitwise Operators to use parentheses to ensure the desired precedence ...