|Found errors or typos? Just edit the page or leave a message on the talk page.|
The English language documentation is canonical and most up to date.
|Holds technical, pre-formatted texts (similar to datatype Text)|
|Provided by:||Semantic MediaWiki|
|Added in version:||1.4.2|
|Removed in version:||still in use|
|In this wiki:||Code|
|Table of Contents|
Code is a built-in datatype of Semantic MediaWiki that is used for technical texts of arbitrary length, such as source code listings. Text is thus very similar to datatype "Text"Holds text of arbitrary length, and it has the same restrictions regarding querying and sorting.
The special functionality of properties of this datatype is that they take some effort to preserve the layout and formatting of their values when displaying them on a wiki page. In particular, newlines and indents are preserved in the display, and some special characters such as "<" are escaped to preserve their appearance. Due to the architecture of MediaWiki and Semantic MediaWiki, it is not possible to achieve this behaviour in any other way than by means of a specialised datatype.
Searching within values
Since Semantic MediaWiki 1.8.0Released on 2 December 2012 and compatible with MW 1.17.0 - 1.22.x
(except 1.22.1). the first 40 characters (if more than 72 characters were stored as property value) or all 72 characters (if a maximum of 72 characters were stored as property value) are searchable as explained on the help page about selecting pages.1 Searching within property values was not possible in earlier versions of Semantic MediaWiki (≤ 1.7.1).
Semantic MediaWiki 2.5.0Released on 14 March 2017 and compatible with MW 1.23.0 - 1.29.x. introduces full-text search2 which allows to search with in more than just the maximum of 72 characters as described before.
Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. introduces configuration parameter
$smwgFieldTypeFeaturesSets relational database specific field type features with it's option
SMW_FIELDT_CHAR_LONG3 making it possible to extend the searchable length as described here to 300 characters4 without relying on the full-text search feature.
- Help page on datatype "Text"Holds text of arbitrary length
- Semantic MediaWiki: User mailing list thread " Unable to query over the last words of a long text value "
- Semantic MediaWiki: GitHub pull request gh:smw:1481
- Semantic MediaWiki: GitHub pull request gh:smw:2536
- Stack Overflow: Question 3489041: Mysql::Error: Specified key was too long; max key length is 1000 bytes