Help:Configuration parameter "$smwgFieldTypeFeatures"

From semantic-mediawiki.org
Jump to: navigation, search
edit with form (experimental)


Title $smwgFieldTypeFeatures
Description Sets relational database specific field type features
Default setting
false
Software Semantic MediaWiki
First version supported
Last version supported still available
Configuration Installation
Keyword database · setup · backend · sqlstore · store · search

$smwgFieldTypeFeatures is a configuration parameter that sets relational database specific field type features. The setting was introduced in Semantic MediaWiki 3.0.0.12

NoteNote: This configuration parameter may only be used in connection with the usage of a relational database as set with configuration parameter $smwgDefaultStoreSets the storage backend to be used for the semantic data.

→ Using the features connected to this configuration parameter is 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.

Default setting

$smwgFieldTypeFeatures = false;

This means that by default no relational database specific field type features will be enabled.

Available options

  • SMW_FIELDT_NONE – Disables features to database field types, identical to false.
  • SMW_FIELDT_CHAR_NOCASE31 – 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 solution4
  • SMW_FIELDT_CHAR_LONG2 – Extends the size to 300 characters for text pattern match fields (DIBlob and DIUri). 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

To modify this configuration setting, add one of the following lines to your "LocalSettings.php" file after the enableSemantics() call:


Enable case insensitive matching for properties of e.g. datatypes "Page", "Text", "Code" and "URL" (blob types, i.e. strings or text)
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_NOCASE;
NoteNote:


Extend searchable field length to 300 characters6 of e.g. datatypes "Text", "Code" and "URL" (blob types, i.e. strings or text except for pages)
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_LONG;
NoteNote: The "setupStore.php" maintenance script followed by the "rebuildData.php" maintenance script has to be run after adding this option.


Combine both options to make a long field type also case insensitive
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_NOCASE | SMW_FIELDT_CHAR_LONG;
NoteNote: The "setupStore.php" maintenance script followed by the "rebuildData.php" maintenance script have to be run after adding these options.

See also

  • Help page on full-text search which is in most cases preferable to using the SMW_FIELDT_CHAR_LONG option to this configuration parameter

Example

See also the related example of <sandbox.semantic-mediawiki.org> showing and commenting on expected results.