$smwgFieldTypeFeatures
| Configuration parameter details: | |
| Name | $smwgFieldTypeFeatures |
| Description | Sets relational database specific field type features |
| Default setting | false |
| Software | Semantic MediaWiki |
| Since version | |
| Until version | still available |
| Configuration | Installation · Experimental |
| Keyword | database · setup · backend · sqlstore · store · search · experimental |
$smwgFieldTypeFeatures is a configuration parameter that sets relational database specific field type features. 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..12
SMWSQLStore3) as set with configuration parameter $smwgDefaultStoreSets the storage backend to be used for the semantic data.
→ Using the features connected to this configuration parameter are experimental!
→ No analysis has been performed on how performance is impacted when choosing either one ore both options. However a decreased performance is to be expected.
'char-nocase', 'char-long') instead of the SMW_FIELDT_* constants. false (no field-type registration at all) is unchanged. Note that an empty array [] registers the component but enables no features; use false to skip registration entirely. 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..3
Default setting[edit]
$smwgFieldTypeFeatures = false;
This means that by default no relational database specific field type features will be enabled.
Available options[edit]
Set the parameter to false to disable field-type registration entirely (the former SMW_FIELDT_NONE). To enable features, list any of the following string keys in an array:
'char-nocase'(formerlySMW_FIELDT_CHAR_NOCASE)41 – Modifies selected search fields to use a case insensitive collation by switching from "VARBINARY" to a collated "VARCHAR". This may even require an additional extension (e.g. PostgreSQL requires "citext") on non MySQL related database systems. Therefore it is disabled by default. If enabled, the setting will replace selected "FieldType::FIELD_TITLE" types with "FieldType::TYPE_CHAR_NOCASE". The latter has been defined as follows:
- - MySQL:
VARCHAR(255) CHARSET utf8 COLLATE utf8_general_ci - - PostgreSQL:
citext NOT NULL - - SQLite:
VARCHAR(255) NOT NULL COLLATE NOCASE, but this may not work and needs a special solution5
'char-long'(formerlySMW_FIELDT_CHAR_LONG)2 – Extends the size to 300 characters for text pattern match fields (DIBlobandDIUri). By default, those fields are limited to 72 characters that limits search depth in exchange for index size and performance. Extending fields to 300 allows to run "LIKE"/"NLIKE" matching on a larger text body without relying on a full-text index but an increased index size could potentially carry a performance penalty when the index cannot be kept in memory.
Changing the default setting[edit]
To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file:
- Enable case insensitive matching for properties of e.g. datatype "Page"Holds names of wiki pages, and displays them as a link, datatype "Text"Holds text of arbitrary length, datatype "Code"Holds technical, pre-formatted texts (similar to datatype Text) and datatype "URL"Holds URIs, URNs and URLs (blob types, i.e. strings or text)
$smwgFieldTypeFeatures = [ 'char-nocase' ];
- If enabled the full-text search only comes into effect for selections using the comparators
~and!~.6 - See the help page on selecting pages for examples
- Extend searchable field length to 300 characters7 of e.g. datatype "Text"Holds text of arbitrary length, datatype "Code"Holds technical, pre-formatted texts (similar to datatype Text) and datatype "URL"Holds URIs, URNs and URLs (blob types, i.e. strings or text except for pages)
$smwgFieldTypeFeatures = [ 'char-long' ];
- Combine both options to make a long field type also case insensitive
$smwgFieldTypeFeatures = [ 'char-nocase', 'char-long' ];
Legacy constant form (deprecated since 7.0.0)[edit]
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_NOCASE | SMW_FIELDT_CHAR_LONG;
SMW_FIELDT_NONE is equivalent to false (no field-type registration).
See also[edit]
- Help page on full-text search which is in most cases preferable to using the
'char-long'option to this configuration parameter
Example[edit]
See also the related example of <sandbox.semantic-mediawiki.org> showing and commenting on expected results. See also this issue comment.6
References
- a b Semantic MediaWiki: GitHub pull request gh:smw:2499
- a b Semantic MediaWiki: GitHub pull request gh:smw:2536
- ^ | | | | | | | | | Semantic MediaWiki: GitHub pull request gh:smw:6793
- ^ Semantic MediaWiki: GitHub issue gh:smw:1912
- ^ Sergei Dorogin’s technical blog: Case-insensitive LIKE in SQLite
- a b Semantic MediaWiki: GitHub issue comment gh:smw:2499:307624826
- ^ Stack Overflow: Question 3489041: Mysql::Error: Specified key was too long; max key length is 1000 bytes