⧼vector-jumptocontent⧽

Id field: Difference between revisions

From EPrints Documentation
mNo edit summary
Added structure to page
Line 1: Line 1:
{{fieldtypes}}
{{fieldtypes}}


[[Metadata]] field. Useful in search as a 'match full value' rather than partial match of e.g. type 'text'
 
== Description ==
This metadata field is very similar to a [[Text field]], the main difference is for search where the whole value is indexed rather than in individual parts.  In particular this is useful for things like ISBN or ISSN numbers which contain hyphens (<tt>-</tt>).  For a text field the parts either side of the hyphen would be indexed separately but for a Id field this will be indexed as a single value.  Therefore, allowing search to find only those items that match exactly.
 
== Inheritance ==
* [[Metadata]]
** [[Text field]]
*** [[Id field]]
 
== Properties ==
Same as [[Text field]].
 
== Required Phrases ==
No additional phrases.
 
== Database ==
Id fields are stored in the database as
fieldname VARCHAR(255)
 
== API ==
See [[API:EPrints/MetaField/Id|API page]].
 
== Examples ==
Most basic example.
{
    name => 'isbn',
    type => 'id',
},
Use a bespoke value renderer to add links to DOIs where appropriate.
{
    name => 'id_number',
    type => 'id',
    render_value => 'EPrints::Extras::render_possible_doi',
},

Revision as of 08:46, 21 March 2023


Description

This metadata field is very similar to a Text field, the main difference is for search where the whole value is indexed rather than in individual parts. In particular this is useful for things like ISBN or ISSN numbers which contain hyphens (-). For a text field the parts either side of the hyphen would be indexed separately but for a Id field this will be indexed as a single value. Therefore, allowing search to find only those items that match exactly.

Inheritance

Properties

Same as Text field.

Required Phrases

No additional phrases.

Database

Id fields are stored in the database as

fieldname VARCHAR(255)

API

See API page.

Examples

Most basic example.

{
    name => 'isbn',
    type => 'id',
},

Use a bespoke value renderer to add links to DOIs where appropriate.

{
    name => 'id_number',
    type => 'id',
    render_value => 'EPrints::Extras::render_possible_doi',
},