$smwgFieldTypeFeatures

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgFieldTypeFeatures
Description Sets relational database specific field type features
Default setting
false
Software Semantic MediaWiki
Since version
Until version still available
Configuration Installation · Experimental
Keyword database · setup · backend · sqlstore · store · search · experimental


$smwgFieldTypeFeatures is a configuration parameter that sets relational database specific field type features. The configuration parameter was introduced in Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x..12

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

→ Using the features connected to this configuration parameter are 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[edit]

$smwgFieldTypeFeatures = false;

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

Available options[edit]

  • 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[edit]

If you change the setting for this configuration parameter, please ensure to run maintenance script "setupStore.php"Allows to set up the data backend/store followed by maintenance script "rebuildData.php"Allows to rebuild all the semantic data for a selected data backend/store.

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

Enable case insensitive matching for properties of e.g. datatype "Page"Holds names of wiki pages, and displays them as a link, datatype "Text"Holds text of arbitrary length, datatype "Code"Holds technical, pre-formatted texts (similar to datatype Text) and datatype "URL"Holds URIs, URNs and URLs (blob types, i.e. strings or text)
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_NOCASE;
Extend searchable field length to 300 characters6 of e.g. datatype "Text"Holds text of arbitrary length, datatype "Code"Holds technical, pre-formatted texts (similar to datatype Text) and datatype "URL"Holds URIs, URNs and URLs (blob types, i.e. strings or text except for pages)
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_LONG;
Combine both options to make a long field type also case insensitive
$smwgFieldTypeFeatures = SMW_FIELDT_CHAR_NOCASE | SMW_FIELDT_CHAR_LONG;

See also[edit]

  • 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[edit]

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




References

  1. a b  Semantic MediaWiki: GitHub pull request gh:smw:2499
  2. a b  Semantic MediaWiki: GitHub pull request gh:smw:2536
  3. ^  Semantic MediaWiki: GitHub issue gh:smw:1912
  4. ^  Sergei Dorogin’s technical blog: Case-insensitive LIKE in SQLite
  5. a b  Semantic MediaWiki: GitHub issue comment gh:smw:2499:307624826
  6. ^  Stack Overflow: Question 3489041: Mysql::Error: Specified key was too long; max key length is 1000 bytes