Help:Class: Difference between revisions

1,640 bytes added ,  24 October 2024
(→‎Features: data types)
Line 58: Line 58:
* Holds a short text that is meant to be parsed by the MediaWiki parser
* Holds a short text that is meant to be parsed by the MediaWiki parser
* Default max size: 300 characters
* Default max size: 300 characters
* Purpose
** This data type is for storing strings that might contain wiki markup, but they are treated primarily as text strings rather than parsed wikitext when displayed.
* Use Case
** Use this when you want to store text that might include wiki syntax, but you don't need this text to be rendered as wiki content every time it's displayed.
** It's useful for storing content where the wikitext might be relevant only in certain contexts or for archival purposes where the raw text with markup is preserved but not necessarily executed.


=== <code>Wikitext</code> ===
=== <code>Wikitext</code> ===
* Holds longer text that is meant to be parsed by the MediaWiki parser
* Holds longer text that is meant to be parsed by the MediaWiki parser
* Unindexed
* Unindexed
** Purpose
*** Designed to store content that includes MediaWiki markup, which should be parsed and rendered as wikitext when displayed. This means when you query this field in Cargo, the result will be formatted according to MediaWiki's parsing rules, turning wiki syntax into HTML.
** Use Case
*** Ideal for fields where the content is meant to be dynamic or formatted, like descriptions, bios, or any content that should appear with links, bold, italics, lists, etc., as intended by the wiki markup.


=== <code>Searchtext</code> ===
=== <code>Searchtext</code> ===
* Holds text that can be searched on, using the [[Special:MyLanguage/Extension:Cargo/Querying data#The "MATCHES" commandMATCHES]] command (requires MySQL 5.6+ or MariaDB 5.6+)
* Holds text that can be searched on, using the [[Special:MyLanguage/Extension:Cargo/Querying data#The "MATCHES" commandMATCHES]] command (requires MySQL 5.6+ or MariaDB 5.6+)
* Purpose
** If there's a need to differentiate content for searching purposes, one might treat certain text fields as plain text for indexing, but this isn't a native Cargo data type; instead, it's more about how data might be processed or indexed for search functionality.
* Use Case
** You might design your database to store content in one form (like Wikitext) but ensure that for searching purposes, a plain text version (Wikitext string could serve this purpose if not intended for rendering) is used to improve search accuracy and performance by avoiding the complexities of wiki markup.


=== <code>File</code> ===
=== <code>File</code> ===