|Holds technical, pre-formatted texts (similar to type Text)|
|Provided by:||Semantic MediaWiki|
|Added in version:||1.4.2|
|Removed in version:||still in use|
|Datatype ID:|| |
|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, and it has the same restrictions regarding querying and sorting.
The special functionality of Type:Code properties 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.0 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 3.0.0 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.
Related query syntax elements
|Help page||Syntax element||Description|
|#ask: annotation query marker|
|Marks an inline query as part of an annotation5|
|#ask: control query marker|
|Allows to dynamically alter a result display without the need to reload a page6|
|#ask: deferred query marker|
|Marks an inline query as deferred from regular parsing6|
|#ask: hierarchy depth restriction|
|Restricts the hierarchy depth of a query7|
|#ask: printout column alignment|
|Defines an alignment for the content of a printout column|
|#ask: printout column width|
|Defines a width for a printout column8|
|#ask: printout sorting order|
|Defines the sorting order for printout statements (dot chain syntax)9|
- 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
- Semantic MediaWiki: GitHub pull request gh:smw:2572
- Semantic MediaWiki: GitHub pull request gh:smw:2398 (Add support for @deferred mode)
- Semantic MediaWiki: GitHub issue gh:smw:2662
- Semantic MediaWiki: GitHub pull request gh:smw:2677
- Semantic MediaWiki: GitHub pull request gh:smw:2073