Difference between revisions of "Text field"

From EPrints Documentation
Jump to: navigation, search
(Description)
m
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
* [[Metadata]]
+
{{fieldtypes}}
** [[Text field]]
+
 
  
 
== Description ==
 
== Description ==
 
 
This is a very simple type of metadata field, which is used as a basis for several others.
 
This is a very simple type of metadata field, which is used as a basis for several others.
  
Line 10: Line 9:
 
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.
 
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.
  
== Properties ==
+
== Inheritance ==
 +
* [[Metadata]]
 +
** [[Id field]]
 +
*** [[Text field]]
 +
 
 +
== Additional Properties ==
 +
As for [[Id field#Additional_Properties|Id fields]] except for
  
 
{| border="1" cellpadding="3" cellspacing="0"
 
{| border="1" cellpadding="3" cellspacing="0"
| name || default || description
+
! Name !! Default Value !! Required !! Description !! Notes
 
|-
 
|-
| '''sql_index''' || 0 || ''as for [[Metadata]] but with a different default.''
+
| '''match''' || <tt>IN</tt> || NO || How to match values in search results. || Different from [[Id field]] default (<tt>EX</tt>). Treat the search value as a list of whitespace-separated words rather than an exact single string to match.
 
|-
 
|-
| '''text_index''' || 1 || ''as for [[Metadata]] but with a different default.''
+
| '''sql_index''' || <tt>0</tt> || NO || Whether field should be index for quicker lookup by the database. || Different from [[Id field]] default (<tt>1</tt>).
 +
|-
 +
| '''text_index''' || <tt>1</tt> || NO || Whether the text for this field should be indexed. || Different from [[Metadata]] default (<tt>0</tt>).
 
|}
 
|}
  
 
== Required Phrases ==
 
== Required Phrases ==
 +
No additional phrases beyond those required for [[Id field#Required_Phrases|Id fields]].
 +
 +
== Database ==
 +
Text fields are stored in the database as
 +
 +
fieldname VARCHAR(255)
 +
 +
== API ==
 +
See [[API:EPrints/MetaField/Text|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,
 +
},

Latest revision as of 13:27, 16 April 2023

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


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

As for Id fields except for

Name Default Value Required Description Notes
match IN NO How to match values in search results. Different from Id field default (EX). Treat the search value as a list of whitespace-separated words rather than an exact single string to match.
sql_index 0 NO Whether field should be index for quicker lookup by the database. Different from Id field default (1).
text_index 1 NO Whether the text for this field should be indexed. Different from Metadata default (0).

Required Phrases

No additional phrases beyond those required for Id fields.

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,
},