Help:Datatype "Code"

Jump to: navigation, search
Holds technical, pre-formatted texts (similar to type Text)
Further Information
Provided by: Semantic MediaWiki
Added in version: 1.4.2
Removed in version: still in use
Datatype ID:
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 2.5.0 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.0 introduces configuration parameter $smwgFieldTypeFeatures
Sets 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.

This documentation page applies to all SMW versions from 1.4.2 to the most current version.
      Other languages: dezh-hans

Help:Type Code en 1.4.2