⧼vector-jumptocontent⧽

Text field: Difference between revisions

From EPrints Documentation
Add examples and link to API page. Moved description to top
mNo edit summary
Line 13: Line 13:
** [[Text field]]
** [[Text field]]


== Properties ==
== Additional Properties ==
{| border="1" cellpadding="3" cellspacing="0"
{| border="1" cellpadding="3" cellspacing="0"
| name || default || description  
| name || default || description  
Line 23: Line 23:


== Required Phrases ==
== Required Phrases ==
No additional phrases.
No additional phrases beyond the [[Metadata#Required_Phrases|standard metadata field phrases]].


== Database ==
== Database ==

Revision as of 23:05, 9 April 2023


Description

This is a very simple type of metadata field, which is used as a basis for several others.

It stores a string of text. The maximum possible length of the string is 255 bytes.

Note that 255 bytes does not mean 255 characters! UTF-8 can use 1 to 4 bytes to store a character. ASCII characters (a-z,0-9 etc) only use 1 byte so it will store 255 ASCII characters, but less of latin and much less of chinese.

Inheritance

Additional Properties

name default description
sql_index 0 as for Metadata but with a different default.
text_index 1 as for Metadata but with a different default.

Required Phrases

No additional phrases beyond the standard metadata field phrases.

Database

Text fields are stored in the database as

fieldname VARCHAR(255)

API

See API page.

Examples

Most basic example.

{
    name => 'publisher',
    type => 'text',
},

Allow multiple values.

{
    name => 'corp_creators',
    type => 'text',
    multiple => 1,
},

Create an index in the SQL database table.

{
    name => 'publisher',
    type => 'text',
    sql_index => 1,
},

Do not allow to be indexed for search.

{
    name => 'private',
    type => 'text',
    text_index => 0,
},