Difference between revisions of "Search.pl"
m (EPrints search config) |
(Added info about staff search) |
||
| Line 2: | Line 2: | ||
In EPrints 3.3, only simple and advanced search configurations will work by default. | In EPrints 3.3, only simple and advanced search configurations will work by default. | ||
See [[How_to_create_a_separate,_searchable_'collection'_(for_eTheses)#EPrints_3.3x_Changes_to_Searching|EPrints 3.3x Changes to Searching]] | See [[How_to_create_a_separate,_searchable_'collection'_(for_eTheses)#EPrints_3.3x_Changes_to_Searching|EPrints 3.3x Changes to Searching]] | ||
| − | |||
==Simple Search== | ==Simple Search== | ||
| Line 66: | Line 65: | ||
default_order => "byyear", | default_order => "byyear", | ||
}; | }; | ||
| − | =Search by Email= | + | |
| + | ==Search by Email== | ||
Searching by email can be the best way to get publications by an individual. To add this functionality to the advanced search simply add this line: | Searching by email can be the best way to get publications by an individual. To add this functionality to the advanced search simply add this line: | ||
{ meta_fields => [ "creators_id" ] }, | { meta_fields => [ "creators_id" ] }, | ||
''creators_id'' is the database column name that contains the email address. | ''creators_id'' is the database column name that contains the email address. | ||
| + | |||
| + | |||
| + | ==Adding fields to the staff search== | ||
| + | In EPrints 3.3.10, additional fields can be added to the staff search: | ||
| + | <source lang="perl"> | ||
| + | $c->{plugins}->{"Screen::Staff::EPrintSearch"}->{params}->{extra_fields} = [ | ||
| + | { meta_fields => [ "institution" ] }, | ||
| + | { meta_fields => [ "id_number" ] }, | ||
| + | { meta_fields => [ "documents.embargo_indefinitely" ] }, | ||
| + | { meta_fields => [ "documents.date_embargo" ] }, | ||
| + | ]; | ||
| + | </source> | ||
| + | This should be added to a file in the config directory e.g. <code>~/archives/ARCHIVEID/cfg/cfg.d/plugins.pl</code>. | ||
| + | |||
| + | In EPrints 3.3.12, the default config for a staff search is in <code>~/lib/cfg.d/eprint_search_staff.pl</code>: | ||
| + | <source lang="perl"> | ||
| + | # Any changes made here will be lost! | ||
| + | # | ||
| + | # Copy this file to: | ||
| + | # archives/[archiveid]/cfg/cfg.d/ | ||
| + | # | ||
| + | # And then make any changes. | ||
| + | |||
| + | $c->{datasets}->{eprint}->{search}->{staff} = | ||
| + | { | ||
| + | search_fields => [ | ||
| + | { meta_fields => [qw( eprintid )] }, | ||
| + | { meta_fields => [qw( userid.username )] }, | ||
| + | { meta_fields => [qw( userid.name )] }, | ||
| + | { meta_fields => [qw( eprint_status )], default=>"archive buffer" }, | ||
| + | { meta_fields => [qw( dir )] }, | ||
| + | @{$c->{search}{advanced}{search_fields}}, | ||
| + | ], | ||
| + | preamble_phrase => "Plugin/Screen/Staff/EPrintSearch:description", | ||
| + | title_phrase => "Plugin/Screen/Staff/EPrintSearch:title", | ||
| + | citation => "result", | ||
| + | page_size => 20, | ||
| + | order_methods => { | ||
| + | "byyear" => "-date/creators_name/title", | ||
| + | "byyearoldest" => "date/creators_name/title", | ||
| + | "byname" => "creators_name/-date/title", | ||
| + | "bytitle" => "title/creators_name/-date" | ||
| + | }, | ||
| + | default_order => "byyear", | ||
| + | show_zero_results => 1, | ||
| + | staff => 1, | ||
| + | }; | ||
| + | </source> | ||
| + | This should be copied to <code>~/archives/ARCHIVEID/cfg/cfg.d/eprint_search_staff.pl</code> and edited as necessary. | ||
Revision as of 09:48, 17 September 2014
Contents
Note
In EPrints 3.3, only simple and advanced search configurations will work by default. See EPrints 3.3x Changes to Searching
Simple Search
$c->{search}->{simple} = {
search_fields => [
{
id => "q",
meta_fields => [
$EPrints::Utils::FULLTEXT,
"title",
"abstract",
"creators_name",
"date"
]
},
],
preamble_phrase => "cgi/search:preamble",
title_phrase => "cgi/search:simple_search",
citation => "result",
page_size => 20,
order_methods => {
"byyear" => "-date/creators_name/title",
"byyearoldest" => "date/creators_name/title",
"byname" => "creators_name/-date/title",
"bytitle" => "title/creators_name/-date"
},
default_order => "byyear",
};
Advanced Search
$c->{search}->{advanced} ={
search_fields => [
{ meta_fields => [ $EPrints::Utils::FULLTEXT ] },
{ meta_fields => [ "title" ] },
{ meta_fields => [ "creators_name" ] },
{ meta_fields => [ "creators_id" ] },
{ meta_fields => [ "abstract" ] },
{ meta_fields => [ "keywords" ] },
{ meta_fields => [ "subjects" ] },
{ meta_fields => [ "divisions" ] },
{ meta_fields => [ "type" ] },
{ meta_fields => [ "department" ] },
{ meta_fields => [ "editors_name" ] },
{ meta_fields => [ "ispublished" ] },
{ meta_fields => [ "refereed" ] },
{ meta_fields => [ "publication" ] },
{ meta_fields => [ "date" ] }
],
preamble_phrase => "cgi/advsearch:preamble",
title_phrase => "cgi/advsearch:adv_search",
citation => "result",
page_size => 20,
order_methods => {
"byyear" => "-date/creators_name/title",
"byyearoldest" => "date/creators_name/title",
"byname" => "creators_name/-date/title",
"bytitle" => "title/creators_name/-date"
},
default_order => "byyear",
};
Search by Email
Searching by email can be the best way to get publications by an individual. To add this functionality to the advanced search simply add this line:
{ meta_fields => [ "creators_id" ] },
creators_id is the database column name that contains the email address.
Adding fields to the staff search
In EPrints 3.3.10, additional fields can be added to the staff search:
$c->{plugins}->{"Screen::Staff::EPrintSearch"}->{params}->{extra_fields} = [
{ meta_fields => [ "institution" ] },
{ meta_fields => [ "id_number" ] },
{ meta_fields => [ "documents.embargo_indefinitely" ] },
{ meta_fields => [ "documents.date_embargo" ] },
];
This should be added to a file in the config directory e.g. ~/archives/ARCHIVEID/cfg/cfg.d/plugins.pl.
In EPrints 3.3.12, the default config for a staff search is in ~/lib/cfg.d/eprint_search_staff.pl:
# Any changes made here will be lost!
#
# Copy this file to:
# archives/[archiveid]/cfg/cfg.d/
#
# And then make any changes.
$c->{datasets}->{eprint}->{search}->{staff} =
{
search_fields => [
{ meta_fields => [qw( eprintid )] },
{ meta_fields => [qw( userid.username )] },
{ meta_fields => [qw( userid.name )] },
{ meta_fields => [qw( eprint_status )], default=>"archive buffer" },
{ meta_fields => [qw( dir )] },
@{$c->{search}{advanced}{search_fields}},
],
preamble_phrase => "Plugin/Screen/Staff/EPrintSearch:description",
title_phrase => "Plugin/Screen/Staff/EPrintSearch:title",
citation => "result",
page_size => 20,
order_methods => {
"byyear" => "-date/creators_name/title",
"byyearoldest" => "date/creators_name/title",
"byname" => "creators_name/-date/title",
"bytitle" => "title/creators_name/-date"
},
default_order => "byyear",
show_zero_results => 1,
staff => 1,
};
This should be copied to ~/archives/ARCHIVEID/cfg/cfg.d/eprint_search_staff.pl and edited as necessary.