Difference between revisions of "Search.pl"

From EPrints Documentation
Jump to: navigation, search
(Added info about staff search)
(Added page about config file)
 
Line 1: Line 1:
== Note ==
+
{{dirs}}
In EPrints 3.3, only simple and advanced search configurations will work by default.
+
{{cfgd}}
See [[How_to_create_a_separate,_searchable_'collection'_(for_eTheses)#EPrints_3.3x_Changes_to_Searching|EPrints 3.3x Changes to Searching]]
 
  
==Simple Search==
+
'''search.pl''' contains generic configution for search. Specific configuration for individual searches exist in their own configuration files:
   
+
* '''[[eprint_search_simple.pl]]''' - Simple search over eprints.
$c->{search}->{simple} = {
+
* '''[[eprint_search_advanced.pl]]''' - Advanced search over eprints.
        search_fields => [
+
* '''[[eprint_search_staff.pl]]''' - Restricted staff-only search over eprints.
                {
+
* '''[[issues_search.pl]]''' - Search over issues with eprints.
                        id => "q",
+
* '''[[latest_tool.pl]]''' - Displaying different listings for latest eprints.
                        meta_fields => [
+
* '''[[user_review_scope.pl]]''' - Managing which eprinst an EPrints ''editor'' user  review.
                                $EPrints::Utils::FULLTEXT,
+
* '''[[user_search.pl]]''' - Search over user records.
                                "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==
+
The configuration within the file includes:
 
+
* '''<code>$c->{match_start_of_name}</code>''' - Text entered in name search field should only match from the start of name.
$c->{search}->{advanced} ={
+
* '''<code>$c->{latest_citation}</code>''' - What citation style should be used in latest item listing, if no citation style is specified for that listing mode.
        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:
 
<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.
 

Latest revision as of 19:35, 30 January 2022

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


Back to cfg.d

search.pl contains generic configution for search. Specific configuration for individual searches exist in their own configuration files:

The configuration within the file includes:

  • $c->{match_start_of_name} - Text entered in name search field should only match from the start of name.
  • $c->{latest_citation} - What citation style should be used in latest item listing, if no citation style is specified for that listing mode.